diff --git a/metricflow/model/semantics/semantic_model_lookup.py b/metricflow/model/semantics/semantic_model_lookup.py index e1eb6bfcb4..c45f349ffc 100644 --- a/metricflow/model/semantics/semantic_model_lookup.py +++ b/metricflow/model/semantics/semantic_model_lookup.py @@ -71,7 +71,7 @@ def __init__( # noqa: D ] = {} self._semantic_model_reference_to_semantic_model: Dict[SemanticModelReference, SemanticModel] = {} - for semantic_model in self._model.semantic_models: + for semantic_model in sorted(self._model.semantic_models, key=lambda semantic_model: semantic_model.name): self._add_semantic_model(semantic_model) def get_dimension_references(self) -> Sequence[DimensionReference]: # noqa: D diff --git a/metricflow/test/conftest.py b/metricflow/test/conftest.py index 31cb6d558e..525b2a30a9 100644 --- a/metricflow/test/conftest.py +++ b/metricflow/test/conftest.py @@ -4,7 +4,7 @@ from metricflow.test.fixtures.cli_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.dataflow_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.id_fixtures import * # noqa: F401, F403 -from metricflow.test.fixtures.model_fixtures import * # noqa: F401, F403 +from metricflow.test.fixtures.manifest_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.setup_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.sql_client_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.sql_fixtures import * # noqa: F401, F403 diff --git a/metricflow/test/dataflow/builder/test_cyclic_join.py b/metricflow/test/dataflow/builder/test_cyclic_join.py index 7d5d5c8935..a14908f039 100644 --- a/metricflow/test/dataflow/builder/test_cyclic_join.py +++ b/metricflow/test/dataflow/builder/test_cyclic_join.py @@ -1,20 +1,20 @@ from __future__ import annotations import logging +from typing import Mapping import pytest from _pytest.fixtures import FixtureRequest from dbt_semantic_interfaces.references import EntityReference from metricflow.dataflow.builder.dataflow_plan_builder import DataflowPlanBuilder -from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup from metricflow.specs.specs import ( DimensionSpec, MetricFlowQuerySpec, MetricSpec, ) from metricflow.test.dataflow_plan_to_svg import display_graph_if_requested -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.fixtures.sql_client_fixtures import sql_client # noqa: F401, F403 from metricflow.test.snapshot_utils import assert_plan_snapshot_text_equal @@ -24,18 +24,9 @@ @pytest.fixture def cyclic_join_manifest_dataflow_plan_builder( # noqa: D - cyclic_join_semantic_manifest_lookup: SemanticManifestLookup, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> DataflowPlanBuilder: - for source_node in consistent_id_object_repository.cyclic_join_source_nodes: - logger.error(f"Source node is: {source_node}") - - return DataflowPlanBuilder( - source_nodes=consistent_id_object_repository.cyclic_join_source_nodes, - read_nodes=list(consistent_id_object_repository.cyclic_join_read_nodes.values()), - semantic_manifest_lookup=cyclic_join_semantic_manifest_lookup, - time_spine_source_node=consistent_id_object_repository.cyclic_join_time_spine_source_node, - ) + return mf_engine_test_fixture_mapping[SemanticManifestSetup.CYCLIC_JOIN_MANIFEST].dataflow_plan_builder def test_cyclic_join( # noqa: D diff --git a/metricflow/test/dataflow/builder/test_node_data_set.py b/metricflow/test/dataflow/builder/test_node_data_set.py index 772abb41cf..5cc6e2e5b5 100644 --- a/metricflow/test/dataflow/builder/test_node_data_set.py +++ b/metricflow/test/dataflow/builder/test_node_data_set.py @@ -1,6 +1,7 @@ from __future__ import annotations import logging +from typing import Mapping from _pytest.fixtures import FixtureRequest from dbt_semantic_interfaces.references import SemanticModelElementReference @@ -24,7 +25,7 @@ ) from metricflow.sql.sql_exprs import SqlColumnReference, SqlColumnReferenceExpression from metricflow.sql.sql_plan import SqlJoinType, SqlSelectColumn, SqlSelectStatementNode, SqlTableFromClauseNode -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.snapshot_utils import assert_spec_set_snapshot_equal @@ -90,7 +91,7 @@ def test_no_parent_node_data_set( def test_joined_node_data_set( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, time_spine_source: TimeSpineSource, ) -> None: @@ -101,8 +102,8 @@ def test_joined_node_data_set( # noqa: D ) # Join "revenue" with "users_latest" to get "user__home_state_latest" - revenue_node = consistent_id_object_repository.simple_model_read_nodes["revenue"] - users_node = consistent_id_object_repository.simple_model_read_nodes["users_latest"] + revenue_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping["revenue"] + users_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping["users_latest"] join_node = JoinToBaseOutputNode( left_node=revenue_node, join_targets=[ diff --git a/metricflow/test/dataflow/builder/test_node_evaluator.py b/metricflow/test/dataflow/builder/test_node_evaluator.py index 2592d87fb5..97944129b3 100644 --- a/metricflow/test/dataflow/builder/test_node_evaluator.py +++ b/metricflow/test/dataflow/builder/test_node_evaluator.py @@ -1,12 +1,11 @@ from __future__ import annotations import logging -from typing import Sequence +from typing import Mapping, Sequence import pytest from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity -from metricflow.dataflow.builder.dataflow_plan_builder import DataflowPlanBuilder from metricflow.dataflow.builder.node_data_set import DataflowPlanNodeOutputDataSetResolver from metricflow.dataflow.builder.node_evaluator import ( JoinLinkableInstancesRecipe, @@ -28,29 +27,28 @@ TimeDimensionSpec, ) from metricflow.sql.sql_plan import SqlJoinType -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup logger = logging.getLogger(__name__) @pytest.fixture def node_evaluator( - consistent_id_object_repository: ConsistentIdObjectRepository, - simple_semantic_manifest_lookup: SemanticManifestLookup, - dataflow_plan_builder: DataflowPlanBuilder, -) -> NodeEvaluatorForLinkableInstances: # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> NodeEvaluatorForLinkableInstances: """Return a node evaluator using the nodes in semantic_model_name_to_nodes.""" + mf_engine_fixture = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST] + node_data_set_resolver: DataflowPlanNodeOutputDataSetResolver = DataflowPlanNodeOutputDataSetResolver( - column_association_resolver=DunderColumnAssociationResolver(simple_semantic_manifest_lookup), - semantic_manifest_lookup=simple_semantic_manifest_lookup, + column_association_resolver=mf_engine_fixture.column_association_resolver, + semantic_manifest_lookup=mf_engine_fixture.semantic_manifest_lookup, ) - source_nodes = tuple(consistent_id_object_repository.simple_model_read_nodes.values()) - return NodeEvaluatorForLinkableInstances( - semantic_model_lookup=simple_semantic_manifest_lookup.semantic_model_lookup, - # Use all nodes in the simple model as candidates for joins. - nodes_available_for_joins=source_nodes, + semantic_model_lookup=mf_engine_test_fixture_mapping[ + SemanticManifestSetup.SIMPLE_MANIFEST + ].semantic_manifest_lookup.semantic_model_lookup, + nodes_available_for_joins=tuple(mf_engine_fixture.read_node_mapping.values()), node_data_set_resolver=node_data_set_resolver, ) @@ -91,10 +89,12 @@ def make_multihop_node_evaluator( def test_node_evaluator_with_no_linkable_specs( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: - bookings_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + bookings_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] evaluation = node_evaluator.evaluate_node( required_linkable_specs=[], start_node=bookings_source_node, default_join_type=SqlJoinType.LEFT_OUTER ) @@ -104,10 +104,12 @@ def test_node_evaluator_with_no_linkable_specs( # noqa: D def test_node_evaluator_with_unjoinable_specs( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: - bookings_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + bookings_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] evaluation = node_evaluator.evaluate_node( required_linkable_specs=[ DimensionSpec( @@ -132,11 +134,13 @@ def test_node_evaluator_with_unjoinable_specs( # noqa: D def test_node_evaluator_with_local_spec( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: """Tests the case where the requested linkable spec in available in the start node.""" - bookings_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + bookings_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] evaluation = node_evaluator.evaluate_node( required_linkable_specs=[DimensionSpec(element_name="is_instant", entity_links=(EntityReference("booking"),))], start_node=bookings_source_node, @@ -151,11 +155,13 @@ def test_node_evaluator_with_local_spec( # noqa: D def test_node_evaluator_with_local_spec_using_primary_entity( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: """Tests the case where the requested linkable spec with an entity link is available in the start node.""" - bookings_source_node = consistent_id_object_repository.simple_model_read_nodes["users_latest"] + bookings_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "users_latest" + ] evaluation = node_evaluator.evaluate_node( required_linkable_specs=[ DimensionSpec(element_name="home_state_latest", entity_links=(EntityReference(element_name="user"),)) @@ -180,11 +186,13 @@ def test_node_evaluator_with_local_spec_using_primary_entity( # noqa: D def test_node_evaluator_with_joined_spec( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: """Tests the case where the requested linkable spec is available if another node is joined.""" - bookings_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + bookings_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] evaluation = node_evaluator.evaluate_node( required_linkable_specs=[ DimensionSpec(element_name="is_instant", entity_links=(EntityReference("booking"),)), @@ -215,7 +223,9 @@ def test_node_evaluator_with_joined_spec( # noqa: D ), join_recipes=( JoinLinkableInstancesRecipe( - node_to_join=consistent_id_object_repository.simple_model_read_nodes["listings_latest"], + node_to_join=mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ], join_on_entity=LinklessEntitySpec.from_element_name("listing"), satisfiable_linkable_specs=[ DimensionSpec( @@ -237,11 +247,13 @@ def test_node_evaluator_with_joined_spec( # noqa: D def test_node_evaluator_with_joined_spec_on_unique_id( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: """Similar to test_node_evaluator_with_joined_spec() but using a unique entity.""" - listings_node = consistent_id_object_repository.simple_model_read_nodes["listings_latest"] + listings_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ] evaluation = node_evaluator.evaluate_node( required_linkable_specs=[ DimensionSpec( @@ -263,7 +275,9 @@ def test_node_evaluator_with_joined_spec_on_unique_id( # noqa: D ), join_recipes=( JoinLinkableInstancesRecipe( - node_to_join=consistent_id_object_repository.simple_model_read_nodes["companies"], + node_to_join=mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "companies" + ], join_on_entity=LinklessEntitySpec.from_element_name("user"), satisfiable_linkable_specs=[ DimensionSpec( @@ -281,11 +295,13 @@ def test_node_evaluator_with_joined_spec_on_unique_id( # noqa: D def test_node_evaluator_with_multiple_joined_specs( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: """Tests the case where multiple nodes need to be joined to get all linkable specs.""" - views_source = consistent_id_object_repository.simple_model_read_nodes["views_source"] + views_source = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "views_source" + ] evaluation = node_evaluator.evaluate_node( required_linkable_specs=[ DimensionSpec( @@ -315,7 +331,9 @@ def test_node_evaluator_with_multiple_joined_specs( # noqa: D ), join_recipes=( JoinLinkableInstancesRecipe( - node_to_join=consistent_id_object_repository.simple_model_read_nodes["listings_latest"], + node_to_join=mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ], join_on_entity=LinklessEntitySpec.from_element_name("listing"), satisfiable_linkable_specs=[ EntitySpec( @@ -328,7 +346,9 @@ def test_node_evaluator_with_multiple_joined_specs( # noqa: D join_type=SqlJoinType.LEFT_OUTER, ), JoinLinkableInstancesRecipe( - node_to_join=consistent_id_object_repository.simple_model_read_nodes["users_latest"], + node_to_join=mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "users_latest" + ], join_on_entity=LinklessEntitySpec.from_element_name("user"), satisfiable_linkable_specs=[ DimensionSpec( @@ -346,11 +366,13 @@ def test_node_evaluator_with_multiple_joined_specs( # noqa: D def test_node_evaluator_with_multihop_joined_spec( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests the case where multiple nodes need to be joined to get all linkable specs.""" - txn_source = consistent_id_object_repository.multihop_model_read_nodes["account_month_txns"] + txn_source = mf_engine_test_fixture_mapping[ + SemanticManifestSetup.PARTITIONED_MULTI_HOP_JOIN_MANIFEST + ].read_node_mapping["account_month_txns"] linkable_specs = [ DimensionSpec( @@ -363,7 +385,9 @@ def test_node_evaluator_with_multihop_joined_spec( # noqa: D ] multihop_node_evaluator = make_multihop_node_evaluator( - model_source_nodes=consistent_id_object_repository.multihop_model_source_nodes, + model_source_nodes=mf_engine_test_fixture_mapping[ + SemanticManifestSetup.PARTITIONED_MULTI_HOP_JOIN_MANIFEST + ].source_nodes, semantic_manifest_lookup_with_multihop_links=partitioned_multi_hop_join_semantic_manifest_lookup, desired_linkable_specs=linkable_specs, ) @@ -417,7 +441,7 @@ def test_node_evaluator_with_multihop_joined_spec( # noqa: D def test_node_evaluator_with_partition_joined_spec( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], node_evaluator: NodeEvaluatorForLinkableInstances, ) -> None: """Tests the case where the joined node required a partitioned join.""" @@ -428,7 +452,9 @@ def test_node_evaluator_with_partition_joined_spec( # noqa: D entity_links=(EntityReference(element_name="user"),), ), ], - start_node=consistent_id_object_repository.simple_model_read_nodes["id_verifications"], + start_node=mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "id_verifications" + ], default_join_type=SqlJoinType.LEFT_OUTER, ) @@ -442,7 +468,9 @@ def test_node_evaluator_with_partition_joined_spec( # noqa: D ), join_recipes=( JoinLinkableInstancesRecipe( - node_to_join=consistent_id_object_repository.simple_model_read_nodes["users_ds_source"], + node_to_join=mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "users_ds_source" + ], join_on_entity=LinklessEntitySpec.from_element_name("user"), satisfiable_linkable_specs=[ DimensionSpec( @@ -471,7 +499,7 @@ def test_node_evaluator_with_partition_joined_spec( # noqa: D def test_node_evaluator_with_scd_target( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests the case where the joined node is an SCD with a validity window filter.""" @@ -480,7 +508,7 @@ def test_node_evaluator_with_scd_target( semantic_manifest_lookup=scd_semantic_manifest_lookup, ) - source_nodes = tuple(consistent_id_object_repository.scd_model_read_nodes.values()) + source_nodes = tuple(mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].read_node_mapping.values()) node_evaluator = NodeEvaluatorForLinkableInstances( semantic_model_lookup=scd_semantic_manifest_lookup.semantic_model_lookup, @@ -496,7 +524,9 @@ def test_node_evaluator_with_scd_target( entity_links=(EntityReference(element_name="listing"),), ) ], - start_node=consistent_id_object_repository.scd_model_read_nodes["bookings_source"], + start_node=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].read_node_mapping[ + "bookings_source" + ], default_join_type=SqlJoinType.LEFT_OUTER, ) @@ -510,7 +540,9 @@ def test_node_evaluator_with_scd_target( ), join_recipes=( JoinLinkableInstancesRecipe( - node_to_join=consistent_id_object_repository.scd_model_read_nodes["listings"], + node_to_join=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].read_node_mapping[ + "listings" + ], join_on_entity=LinklessEntitySpec.from_element_name("listing"), satisfiable_linkable_specs=[ DimensionSpec( @@ -532,7 +564,7 @@ def test_node_evaluator_with_scd_target( def test_node_evaluator_with_multi_hop_scd_target( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests the case where the joined node is an SCD reached through another node. @@ -542,14 +574,16 @@ def test_node_evaluator_with_multi_hop_scd_target( """ linkable_specs = [DimensionSpec.from_name("listing__lux_listing__is_confirmed_lux")] node_evaluator = make_multihop_node_evaluator( - model_source_nodes=consistent_id_object_repository.scd_model_source_nodes, + model_source_nodes=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].source_nodes, semantic_manifest_lookup_with_multihop_links=scd_semantic_manifest_lookup, desired_linkable_specs=linkable_specs, ) evaluation = node_evaluator.evaluate_node( required_linkable_specs=linkable_specs, - start_node=consistent_id_object_repository.scd_model_read_nodes["bookings_source"], + start_node=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].read_node_mapping[ + "bookings_source" + ], default_join_type=SqlJoinType.LEFT_OUTER, ) @@ -595,7 +629,7 @@ def test_node_evaluator_with_multi_hop_scd_target( def test_node_evaluator_with_multi_hop_through_scd( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests the case where the joined node is reached via an SCD. @@ -605,14 +639,16 @@ def test_node_evaluator_with_multi_hop_through_scd( """ linkable_specs = [DimensionSpec.from_name("listing__user__home_state_latest")] node_evaluator = make_multihop_node_evaluator( - model_source_nodes=consistent_id_object_repository.scd_model_source_nodes, + model_source_nodes=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].source_nodes, semantic_manifest_lookup_with_multihop_links=scd_semantic_manifest_lookup, desired_linkable_specs=linkable_specs, ) evaluation = node_evaluator.evaluate_node( required_linkable_specs=linkable_specs, - start_node=consistent_id_object_repository.scd_model_read_nodes["bookings_source"], + start_node=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].read_node_mapping[ + "bookings_source" + ], default_join_type=SqlJoinType.LEFT_OUTER, ) @@ -654,7 +690,7 @@ def test_node_evaluator_with_multi_hop_through_scd( def test_node_evaluator_with_invalid_multi_hop_scd( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests the case where the joined node is reached via an illegal SCD <-> SCD join. @@ -663,14 +699,16 @@ def test_node_evaluator_with_invalid_multi_hop_scd( """ linkable_specs = [DimensionSpec.from_name("listing__user__account_type")] node_evaluator = make_multihop_node_evaluator( - model_source_nodes=consistent_id_object_repository.scd_model_source_nodes, + model_source_nodes=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].source_nodes, semantic_manifest_lookup_with_multihop_links=scd_semantic_manifest_lookup, desired_linkable_specs=linkable_specs, ) evaluation = node_evaluator.evaluate_node( required_linkable_specs=linkable_specs, - start_node=consistent_id_object_repository.scd_model_read_nodes["bookings_source"], + start_node=mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].read_node_mapping[ + "bookings_source" + ], default_join_type=SqlJoinType.LEFT_OUTER, ) diff --git a/metricflow/test/dataflow/optimizer/source_scan/test_cm_branch_combiner.py b/metricflow/test/dataflow/optimizer/source_scan/test_cm_branch_combiner.py index 3398d98386..a7968cb035 100644 --- a/metricflow/test/dataflow/optimizer/source_scan/test_cm_branch_combiner.py +++ b/metricflow/test/dataflow/optimizer/source_scan/test_cm_branch_combiner.py @@ -1,5 +1,7 @@ from __future__ import annotations +from typing import Mapping + import pytest from _pytest.fixtures import FixtureRequest @@ -16,7 +18,7 @@ ) from metricflow.specs.specs import InstanceSpecSet, MeasureSpec from metricflow.test.dataflow_plan_to_svg import display_graph_if_requested -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.snapshot_utils import assert_plan_snapshot_text_equal @@ -32,11 +34,11 @@ def make_dataflow_plan(node: BaseOutput) -> DataflowPlan: # noqa: D def test_read_sql_source_combination( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], ) -> None: """Tests combining a single node.""" - source0 = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] - source1 = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source0 = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping["bookings_source"] + source1 = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping["bookings_source"] combiner = ComputeMetricsBranchCombiner(source0) result: ComputeMetricsBranchCombinerResult = source1.accept(combiner) @@ -61,14 +63,14 @@ def test_read_sql_source_combination( # noqa: D def test_filter_combination( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], ) -> None: """Tests combining a single node.""" - source0 = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source0 = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping["bookings_source"] filter0 = FilterElementsNode( parent_node=source0, include_specs=InstanceSpecSet(measure_specs=(MeasureSpec(element_name="bookings"),)) ) - source1 = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source1 = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping["bookings_source"] filter1 = FilterElementsNode( parent_node=source1, include_specs=InstanceSpecSet( diff --git a/metricflow/test/dataset/test_convert_semantic_model.py b/metricflow/test/dataset/test_convert_semantic_model.py index 9aa2f58f12..0b1b48a203 100644 --- a/metricflow/test/dataset/test_convert_semantic_model.py +++ b/metricflow/test/dataset/test_convert_semantic_model.py @@ -1,13 +1,14 @@ from __future__ import annotations import logging +from typing import Mapping import pytest from _pytest.fixtures import FixtureRequest from dbt_semantic_interfaces.references import SemanticModelReference from metricflow.protocols.sql_client import SqlClient -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.snapshot_utils import assert_spec_set_snapshot_equal from metricflow.test.sql.compare_sql_plan import assert_rendered_sql_equal @@ -20,10 +21,12 @@ def test_convert_table_semantic_model_without_measures( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, sql_client: SqlClient, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], ) -> None: """Simple test for converting a table semantic model. Since there are no measures, primary time is not checked.""" - users_data_set = consistent_id_object_repository.simple_model_data_sets["users_latest"] + users_data_set = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].data_set_mapping[ + "users_latest" + ] assert_spec_set_snapshot_equal( request=request, @@ -46,14 +49,16 @@ def test_convert_table_semantic_model_with_measures( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, sql_client: SqlClient, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], ) -> None: """Complete test of table semantic model conversion. This includes the full set of measures/entities/dimensions. Measures trigger a primary time dimension validation. Additionally, this includes both categorical and time dimension types, which should cover most, if not all, of the table source branches in the target class. """ - id_verifications_data_set = consistent_id_object_repository.simple_model_data_sets["id_verifications"] + id_verifications_data_set = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].data_set_mapping[ + "id_verifications" + ] assert_spec_set_snapshot_equal( request=request, @@ -79,9 +84,11 @@ def test_convert_query_semantic_model( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, sql_client: SqlClient, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], ) -> None: - bookings_data_set = consistent_id_object_repository.simple_model_data_sets["revenue"] + bookings_data_set = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].data_set_mapping[ + "revenue" + ] assert_rendered_sql_equal( request=request, diff --git a/metricflow/test/fixtures/dataflow_fixtures.py b/metricflow/test/fixtures/dataflow_fixtures.py index 8320a2059b..bbbda11902 100644 --- a/metricflow/test/fixtures/dataflow_fixtures.py +++ b/metricflow/test/fixtures/dataflow_fixtures.py @@ -1,15 +1,15 @@ from __future__ import annotations +from typing import Mapping + import pytest from metricflow.dataflow.builder.dataflow_plan_builder import DataflowPlanBuilder -from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup -from metricflow.plan_conversion.column_resolver import DunderColumnAssociationResolver from metricflow.plan_conversion.time_spine import TimeSpineSource from metricflow.protocols.sql_client import SqlClient from metricflow.query.query_parser import MetricFlowQueryParser from metricflow.specs.column_assoc import ColumnAssociationResolver -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.fixtures.sql_client_fixtures import sql_client # noqa: F401, F403 @@ -20,94 +20,66 @@ """ -@pytest.fixture +@pytest.fixture(scope="session") def column_association_resolver( # noqa: D - simple_semantic_manifest_lookup: SemanticManifestLookup, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> ColumnAssociationResolver: - return DunderColumnAssociationResolver(simple_semantic_manifest_lookup) + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].column_association_resolver @pytest.fixture def dataflow_plan_builder( # noqa: D - simple_semantic_manifest_lookup: SemanticManifestLookup, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> DataflowPlanBuilder: - return DataflowPlanBuilder( - source_nodes=consistent_id_object_repository.simple_model_source_nodes, - read_nodes=list(consistent_id_object_repository.simple_model_read_nodes.values()), - semantic_manifest_lookup=simple_semantic_manifest_lookup, - time_spine_source_node=consistent_id_object_repository.simple_model_time_spine_source_node, - ) + # Scope needs to be function as the DataflowPlanBuilder contains state. + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].dataflow_plan_builder -@pytest.fixture +@pytest.fixture(scope="session") def query_parser( # noqa: D - simple_semantic_manifest_lookup: SemanticManifestLookup, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> MetricFlowQueryParser: - return MetricFlowQueryParser( - semantic_manifest_lookup=simple_semantic_manifest_lookup, - ) + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].query_parser @pytest.fixture def extended_date_dataflow_plan_builder( # noqa: D - extended_date_semantic_manifest_lookup: SemanticManifestLookup, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> DataflowPlanBuilder: - return DataflowPlanBuilder( - source_nodes=consistent_id_object_repository.extended_date_model_source_nodes, - read_nodes=list(consistent_id_object_repository.extended_date_model_read_nodes.values()), - semantic_manifest_lookup=extended_date_semantic_manifest_lookup, - time_spine_source_node=consistent_id_object_repository.extended_date_model_time_spine_source_node, - ) + # Scope needs to be function as the DataflowPlanBuilder contains state. + return mf_engine_test_fixture_mapping[SemanticManifestSetup.EXTENDED_DATE_MANIFEST].dataflow_plan_builder @pytest.fixture def multihop_dataflow_plan_builder( # noqa: D - partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup, - consistent_id_object_repository: ConsistentIdObjectRepository, - time_spine_source: TimeSpineSource, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> DataflowPlanBuilder: - return DataflowPlanBuilder( - source_nodes=consistent_id_object_repository.multihop_model_source_nodes, - read_nodes=list(consistent_id_object_repository.multihop_model_read_nodes.values()), - semantic_manifest_lookup=partitioned_multi_hop_join_semantic_manifest_lookup, - time_spine_source_node=consistent_id_object_repository.multihop_model_time_spine_source_node, - ) + # Scope needs to be function as the DataflowPlanBuilder contains state. + return mf_engine_test_fixture_mapping[ + SemanticManifestSetup.PARTITIONED_MULTI_HOP_JOIN_MANIFEST + ].dataflow_plan_builder -@pytest.fixture +@pytest.fixture(scope="session") def scd_column_association_resolver( # noqa: D - scd_semantic_manifest_lookup: SemanticManifestLookup, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> ColumnAssociationResolver: - return DunderColumnAssociationResolver(scd_semantic_manifest_lookup) + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].column_association_resolver @pytest.fixture def scd_dataflow_plan_builder( # noqa: D - scd_semantic_manifest_lookup: SemanticManifestLookup, - scd_column_association_resolver: ColumnAssociationResolver, - consistent_id_object_repository: ConsistentIdObjectRepository, - time_spine_source: TimeSpineSource, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> DataflowPlanBuilder: - return DataflowPlanBuilder( - source_nodes=consistent_id_object_repository.scd_model_source_nodes, - read_nodes=list(consistent_id_object_repository.scd_model_read_nodes.values()), - semantic_manifest_lookup=scd_semantic_manifest_lookup, - column_association_resolver=scd_column_association_resolver, - time_spine_source_node=consistent_id_object_repository.scd_model_time_spine_source_node, - ) + # Scope needs to be function as the DataflowPlanBuilder contains state. + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].dataflow_plan_builder -@pytest.fixture +@pytest.fixture(scope="session") def scd_query_parser( # noqa: D - scd_column_association_resolver: ColumnAssociationResolver, - scd_semantic_manifest_lookup: SemanticManifestLookup, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> MetricFlowQueryParser: - return MetricFlowQueryParser( - semantic_manifest_lookup=scd_semantic_manifest_lookup, - ) + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].query_parser @pytest.fixture(scope="session") diff --git a/metricflow/test/fixtures/id_fixtures.py b/metricflow/test/fixtures/id_fixtures.py index 888d3eb621..f47f68b930 100644 --- a/metricflow/test/fixtures/id_fixtures.py +++ b/metricflow/test/fixtures/id_fixtures.py @@ -1,6 +1,7 @@ from __future__ import annotations from contextlib import ExitStack, contextmanager +from dataclasses import dataclass from typing import Generator from unittest.mock import patch @@ -10,29 +11,49 @@ from metricflow.dag.prefix_id import PrefixIdGenerator +@dataclass(frozen=True) class IdNumberSpace: """Defines the numbering of IDs when setting up tests and test fixtures.""" - # Before each test run. - TEST_START = 0 - # When setting up the ConsistentIdObjectRepository - CONSISTENT_ID_REPOSITORY = 10000 + start_value: int + @staticmethod + def for_test_start() -> IdNumberSpace: + """Before each test run.""" + return IdNumberSpace(0) -@pytest.fixture(autouse=True) + @staticmethod + def for_block(block_index: int, block_size: int = 2000, first_block_offset: int = 10000) -> IdNumberSpace: + """Used to define fixed-size blocks of ID number spaces. + + This is useful for creating unique / non-overlapping IDs for different groups of objects. + """ + if not block_index >= 0: + raise RuntimeError(f"block_index should be >= 0. Got: {block_index}") + if not block_size > 1: + raise RuntimeError(f"block_size should be > 1. Got: {block_size}") + if not first_block_offset >= 0: + raise RuntimeError(f"first_block_offset should be >= 0. Got: {first_block_offset}") + return IdNumberSpace(first_block_offset + block_size * block_index) + + +@pytest.fixture(autouse=True, scope="function") def patch_id_generators() -> Generator[None, None, None]: """Patch ID generators with a new one to get repeatability in plan outputs before every test. Plan outputs contain IDs, so if the IDs are not consistent from run to run, there will be diffs in the actual vs. expected outputs during a test. """ - with patch_id_generators_helper(start_value=IdNumberSpace.TEST_START): + with patch_id_generators_helper(start_value=IdNumberSpace.for_test_start().start_value): yield None @contextmanager def patch_id_generators_helper(start_value: int) -> Generator[None, None, None]: - """Replace ID generators in IdGeneratorRegistry with one that has the given start value.""" + """Replace ID generators in IdGeneratorRegistry with one that has the given start value. + + TODO: This method will be modified in a later PR. + """ # Create patch context managers for all ID generators in the registry with introspection magic. patch_context_managers = [ patch.object(IdGeneratorRegistry, "_class_name_to_id_generator", {}), diff --git a/metricflow/test/fixtures/manifest_fixtures.py b/metricflow/test/fixtures/manifest_fixtures.py new file mode 100644 index 0000000000..91d23610c0 --- /dev/null +++ b/metricflow/test/fixtures/manifest_fixtures.py @@ -0,0 +1,368 @@ +from __future__ import annotations + +import logging +import os +from collections import OrderedDict +from dataclasses import dataclass +from enum import Enum +from typing import Dict, Mapping, Optional, Sequence, Tuple + +import pytest +from dbt_semantic_interfaces.implementations.semantic_manifest import PydanticSemanticManifest +from dbt_semantic_interfaces.parsing.dir_to_model import ( + SemanticManifestBuildResult, + parse_directory_of_yaml_files_to_semantic_manifest, +) +from dbt_semantic_interfaces.protocols import SemanticModel +from dbt_semantic_interfaces.test_utils import as_datetime +from dbt_semantic_interfaces.validations.semantic_manifest_validator import SemanticManifestValidator + +from metricflow.dataflow.builder.dataflow_plan_builder import DataflowPlanBuilder +from metricflow.dataflow.builder.node_data_set import DataflowPlanNodeOutputDataSetResolver +from metricflow.dataflow.builder.source_node import SourceNodeBuilder +from metricflow.dataflow.dataflow_plan import BaseOutput, MetricTimeDimensionTransformNode, ReadSqlSourceNode +from metricflow.dataset.convert_semantic_model import SemanticModelToDataSetConverter +from metricflow.dataset.semantic_model_adapter import SemanticModelDataSet +from metricflow.engine.metricflow_engine import MetricFlowEngine +from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup +from metricflow.plan_conversion.column_resolver import DunderColumnAssociationResolver +from metricflow.plan_conversion.dataflow_to_sql import DataflowToSqlQueryPlanConverter +from metricflow.protocols.sql_client import SqlClient +from metricflow.query.query_parser import MetricFlowQueryParser +from metricflow.specs.column_assoc import ColumnAssociationResolver +from metricflow.test.fixtures.id_fixtures import IdNumberSpace, patch_id_generators_helper +from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState +from metricflow.test.time.configurable_time_source import ConfigurableTimeSource + +logger = logging.getLogger(__name__) + + +@dataclass(frozen=True) +class SemanticManifestSetupPropertySet: + """Describes a semantic manifest used in testing.""" + + # Name corresponds to a directory under test/fixtures/semantic_manifest_yamls. + semantic_manifest_name: str + # Specify a separate start value for each semantic manifest to reduce snapshot thrash when one semantic manifest + # is modified. i.e. without this, modifying the first semantic manifest might cause all IDs in snapshots associated + # with semantic manifests following the first one to change. + id_number_space: IdNumberSpace + + +class SemanticManifestSetup(Enum): + """Enumeration of semantic manifests that defined in YAML files and used for testing.""" + + AMBIGUOUS_RESOLUTION_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="ambiguous_resolution_manifest", + id_number_space=IdNumberSpace.for_block(0), + ) + # Not including CONFIG_LINTER_MANIFEST as it has intentional errors for running validations. + CYCLIC_JOIN_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="cyclic_join_manifest", id_number_space=IdNumberSpace.for_block(1) + ) + DATA_WAREHOUSE_VALIDATION_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="data_warehouse_validation_manifest", id_number_space=IdNumberSpace.for_block(2) + ) + EXTENDED_DATE_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="extended_date_manifest", id_number_space=IdNumberSpace.for_block(3) + ) + JOIN_TYPES_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="join_types_manifest", id_number_space=IdNumberSpace.for_block(4) + ) + MULTI_HOP_JOIN_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="multi_hop_join_manifest", id_number_space=IdNumberSpace.for_block(5) + ) + PARTITIONED_MULTI_HOP_JOIN_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="partitioned_multi_hop_join_manifest", id_number_space=IdNumberSpace.for_block(6) + ) + NON_SM_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="non_sm_manifest", id_number_space=IdNumberSpace.for_block(7) + ) + SCD_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="scd_manifest", id_number_space=IdNumberSpace.for_block(8) + ) + SIMPLE_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="simple_manifest", id_number_space=IdNumberSpace.for_block(9) + ) + SIMPLE_MULTI_HOP_JOIN_MANIFEST = SemanticManifestSetupPropertySet( + semantic_manifest_name="simple_multi_hop_join_manifest", id_number_space=IdNumberSpace.for_block(10) + ) + + @property + def id_number_space(self) -> IdNumberSpace: # noqa: D + return self.value.id_number_space + + @property + def semantic_manifest_name(self) -> str: # noqa: D + return self.value.semantic_manifest_name + + +@dataclass(frozen=True) +class MetricFlowEngineTestFixture: + """Contains objects for testing the MF engine for a specific semantic manifest.""" + + semantic_manifest: PydanticSemanticManifest + semantic_manifest_lookup: SemanticManifestLookup + column_association_resolver: ColumnAssociationResolver + data_set_mapping: OrderedDict[str, SemanticModelDataSet] + read_node_mapping: OrderedDict[str, ReadSqlSourceNode] + source_nodes: Tuple[BaseOutput, ...] + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter + query_parser: MetricFlowQueryParser + metricflow_engine: MetricFlowEngine + + @staticmethod + def from_parameters( # noqa: D + sql_client: SqlClient, semantic_manifest: PydanticSemanticManifest + ) -> MetricFlowEngineTestFixture: + semantic_manifest_lookup = SemanticManifestLookup(semantic_manifest) + data_set_mapping = MetricFlowEngineTestFixture._create_data_sets(semantic_manifest_lookup) + read_node_mapping = MetricFlowEngineTestFixture._data_set_to_read_nodes(data_set_mapping) + source_nodes = MetricFlowEngineTestFixture._data_set_to_source_nodes(semantic_manifest_lookup, data_set_mapping) + column_association_resolver = DunderColumnAssociationResolver(semantic_manifest_lookup) + + query_parser = MetricFlowQueryParser(semantic_manifest_lookup=semantic_manifest_lookup) + return MetricFlowEngineTestFixture( + semantic_manifest=semantic_manifest, + semantic_manifest_lookup=semantic_manifest_lookup, + column_association_resolver=column_association_resolver, + data_set_mapping=data_set_mapping, + read_node_mapping=read_node_mapping, + source_nodes=tuple(source_nodes), + dataflow_to_sql_converter=DataflowToSqlQueryPlanConverter( + column_association_resolver=column_association_resolver, + semantic_manifest_lookup=semantic_manifest_lookup, + ), + query_parser=query_parser, + metricflow_engine=MetricFlowEngine( + semantic_manifest_lookup=semantic_manifest_lookup, + sql_client=sql_client, + time_source=ConfigurableTimeSource(as_datetime("2020-01-01")), + query_parser=query_parser, + column_association_resolver=column_association_resolver, + ), + ) + + @property + def dataflow_plan_builder(self) -> DataflowPlanBuilder: + """Return a DataflowPlanBuilder that can be used for tests. + + This should be recreated for each test since DataflowPlanBuilder contains a stateful cache. + """ + source_nodes = MetricFlowEngineTestFixture._data_set_to_source_nodes( + self.semantic_manifest_lookup, self.data_set_mapping + ) + time_spine_source_node = MetricFlowEngineTestFixture._build_time_spine_source_node( + self.semantic_manifest_lookup + ) + node_output_resolver = DataflowPlanNodeOutputDataSetResolver( + column_association_resolver=self.column_association_resolver, + semantic_manifest_lookup=self.semantic_manifest_lookup, + ) + return DataflowPlanBuilder( + source_nodes=source_nodes, + read_nodes=tuple(self.read_node_mapping.values()), + time_spine_source_node=time_spine_source_node, + semantic_manifest_lookup=self.semantic_manifest_lookup, + node_output_resolver=node_output_resolver, + column_association_resolver=self.column_association_resolver, + ) + + @staticmethod + def _data_set_to_read_nodes( + data_sets: OrderedDict[str, SemanticModelDataSet] + ) -> OrderedDict[str, ReadSqlSourceNode]: + """Return a mapping from the name of the semantic model to the dataflow plan node that reads from it.""" + # Moved from model_fixtures.py. + return_dict: OrderedDict[str, ReadSqlSourceNode] = OrderedDict() + for semantic_model_name, data_set in data_sets.items(): + return_dict[semantic_model_name] = ReadSqlSourceNode(data_set) + logger.debug( + f"For semantic model {semantic_model_name}, creating node_id {return_dict[semantic_model_name].node_id}" + ) + + return return_dict + + @staticmethod + def _data_set_to_source_nodes( + semantic_manifest_lookup: SemanticManifestLookup, data_sets: OrderedDict[str, SemanticModelDataSet] + ) -> Sequence[BaseOutput]: + # Moved from model_fixtures.py. + source_node_builder = SourceNodeBuilder(semantic_manifest_lookup) + return source_node_builder.create_from_data_sets(list(data_sets.values())) + + @staticmethod + def _build_time_spine_source_node( + semantic_manifest_lookup: SemanticManifestLookup, + ) -> MetricTimeDimensionTransformNode: + # Moved from model_fixtures.py. + return SourceNodeBuilder.build_time_spine_source_node( + time_spine_source=semantic_manifest_lookup.time_spine_source, + data_set_converter=SemanticModelToDataSetConverter( + column_association_resolver=DunderColumnAssociationResolver(semantic_manifest_lookup) + ), + ) + + @staticmethod + def _create_data_sets( + multihop_semantic_manifest_lookup: SemanticManifestLookup, + ) -> OrderedDict[str, SemanticModelDataSet]: + """Convert the SemanticModels in the model to SqlDataSets. + + Key is the name of the semantic model, value is the associated data set. + """ + # Moved from model_fixtures.py. + + # Use ordered dict and sort by name to get consistency when running tests. + data_sets = OrderedDict() + semantic_models: Sequence[SemanticModel] = multihop_semantic_manifest_lookup.semantic_manifest.semantic_models + semantic_models = sorted(semantic_models, key=lambda x: x.name) + + converter = SemanticModelToDataSetConverter( + column_association_resolver=DunderColumnAssociationResolver(multihop_semantic_manifest_lookup) + ) + + for semantic_model in semantic_models: + data_sets[semantic_model.name] = converter.create_sql_source_data_set(semantic_model) + + return data_sets + + +@pytest.fixture(scope="session") +def mf_engine_test_fixture_mapping( + template_mapping: Dict[str, str], + sql_client: SqlClient, +) -> Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture]: + """Returns a mapping for all semantic manifests used in testing to the associated test fixture.""" + fixture_mapping: Dict[SemanticManifestSetup, MetricFlowEngineTestFixture] = {} + for semantic_manifest_setup in SemanticManifestSetup: + with patch_id_generators_helper(semantic_manifest_setup.id_number_space.start_value): + try: + build_result = load_semantic_manifest(semantic_manifest_setup.semantic_manifest_name, template_mapping) + except Exception as e: + raise RuntimeError(f"Error while loading semantic manifest: {semantic_manifest_setup}") from e + + fixture_mapping[semantic_manifest_setup] = MetricFlowEngineTestFixture.from_parameters( + sql_client, build_result.semantic_manifest + ) + + return fixture_mapping + + +def load_semantic_manifest( + relative_manifest_path: str, + template_mapping: Optional[Dict[str, str]] = None, +) -> SemanticManifestBuildResult: + """Reads the manifest YAMLs from the standard location, applies transformations, runs validations.""" + yaml_file_directory = os.path.join(os.path.dirname(__file__), f"semantic_manifest_yamls/{relative_manifest_path}") + build_result = parse_directory_of_yaml_files_to_semantic_manifest( + yaml_file_directory, template_mapping=template_mapping + ) + validator = SemanticManifestValidator[PydanticSemanticManifest]() + validator.checked_validations(build_result.semantic_manifest) + return build_result + + +@pytest.fixture(scope="session") +def template_mapping(mf_test_session_state: MetricFlowTestSessionState) -> Dict[str, str]: + """Mapping for template variables in the model YAML files.""" + return {"source_schema": mf_test_session_state.mf_source_schema} + + +@pytest.fixture(scope="session") +def simple_semantic_manifest_lookup_non_ds( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + return mf_engine_test_fixture_mapping[SemanticManifestSetup.NON_SM_MANIFEST].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def simple_semantic_manifest_lookup( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def partitioned_multi_hop_join_semantic_manifest_lookup( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + return mf_engine_test_fixture_mapping[ + SemanticManifestSetup.PARTITIONED_MULTI_HOP_JOIN_MANIFEST + ].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def multi_hop_join_semantic_manifest_lookup( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + return mf_engine_test_fixture_mapping[SemanticManifestSetup.MULTI_HOP_JOIN_MANIFEST].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def simple_semantic_manifest( + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> PydanticSemanticManifest: + """Model used for many tests.""" + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].semantic_manifest + + +@pytest.fixture(scope="session") +def extended_date_semantic_manifest_lookup( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + return mf_engine_test_fixture_mapping[SemanticManifestSetup.EXTENDED_DATE_MANIFEST].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def scd_semantic_manifest_lookup( + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + """Initialize semantic model for SCD tests.""" + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def data_warehouse_validation_model( + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> PydanticSemanticManifest: + """Model used for data warehouse validation tests.""" + return mf_engine_test_fixture_mapping[SemanticManifestSetup.DATA_WAREHOUSE_VALIDATION_MANIFEST].semantic_manifest + + +@pytest.fixture(scope="session") +def cyclic_join_semantic_manifest_lookup( + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + """Manifest that contains a potential cycle in the join graph (if not handled properly).""" + return mf_engine_test_fixture_mapping[SemanticManifestSetup.CYCLIC_JOIN_MANIFEST].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def ambiguous_resolution_manifest( + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> PydanticSemanticManifest: + """Manifest used to test ambiguous resolution of group-by-items.""" + return mf_engine_test_fixture_mapping[SemanticManifestSetup.AMBIGUOUS_RESOLUTION_MANIFEST].semantic_manifest + + +@pytest.fixture(scope="session") +def ambiguous_resolution_manifest_lookup( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + return mf_engine_test_fixture_mapping[SemanticManifestSetup.AMBIGUOUS_RESOLUTION_MANIFEST].semantic_manifest_lookup + + +@pytest.fixture(scope="session") +def simple_multi_hop_join_manifest( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> PydanticSemanticManifest: + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MULTI_HOP_JOIN_MANIFEST].semantic_manifest + + +@pytest.fixture(scope="session") +def simple_multi_hop_join_manifest_lookup( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> SemanticManifestLookup: + """Manifest used to test ambiguous resolution of group-by-items.""" + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MULTI_HOP_JOIN_MANIFEST].semantic_manifest_lookup diff --git a/metricflow/test/fixtures/model_fixtures.py b/metricflow/test/fixtures/model_fixtures.py deleted file mode 100644 index 55357b1175..0000000000 --- a/metricflow/test/fixtures/model_fixtures.py +++ /dev/null @@ -1,319 +0,0 @@ -from __future__ import annotations - -import logging -import os -from collections import OrderedDict -from dataclasses import dataclass -from typing import Dict, List, Optional, Sequence - -import pytest -from dbt_semantic_interfaces.implementations.semantic_manifest import PydanticSemanticManifest -from dbt_semantic_interfaces.parsing.dir_to_model import ( - SemanticManifestBuildResult, - parse_directory_of_yaml_files_to_semantic_manifest, - parse_yaml_files_to_validation_ready_semantic_manifest, -) -from dbt_semantic_interfaces.parsing.objects import YamlConfigFile -from dbt_semantic_interfaces.protocols.semantic_manifest import SemanticManifest -from dbt_semantic_interfaces.protocols.semantic_model import SemanticModel -from dbt_semantic_interfaces.transformations.pydantic_rule_set import PydanticSemanticManifestTransformRuleSet -from dbt_semantic_interfaces.transformations.semantic_manifest_transformer import PydanticSemanticManifestTransformer -from dbt_semantic_interfaces.validations.semantic_manifest_validator import SemanticManifestValidator - -from metricflow.dataflow.builder.node_data_set import DataflowPlanNodeOutputDataSetResolver -from metricflow.dataflow.builder.source_node import SourceNodeBuilder -from metricflow.dataflow.dataflow_plan import BaseOutput, MetricTimeDimensionTransformNode, ReadSqlSourceNode -from metricflow.dataset.convert_semantic_model import SemanticModelToDataSetConverter -from metricflow.dataset.semantic_model_adapter import SemanticModelDataSet -from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup -from metricflow.plan_conversion.column_resolver import DunderColumnAssociationResolver -from metricflow.query.query_parser import MetricFlowQueryParser -from metricflow.test.fixtures.id_fixtures import IdNumberSpace, patch_id_generators_helper -from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState - -logger = logging.getLogger(__name__) - - -def _data_set_to_read_nodes(data_sets: OrderedDict[str, SemanticModelDataSet]) -> OrderedDict[str, ReadSqlSourceNode]: - """Return a mapping from the name of the semantic model to the dataflow plan node that reads from it.""" - return_dict: OrderedDict[str, ReadSqlSourceNode] = OrderedDict() - for semantic_model_name, data_set in data_sets.items(): - return_dict[semantic_model_name] = ReadSqlSourceNode(data_set) - logger.debug( - f"For semantic model {semantic_model_name}, creating node_id {return_dict[semantic_model_name].node_id}" - ) - - return return_dict - - -def _data_set_to_source_nodes( - semantic_manifest_lookup: SemanticManifestLookup, data_sets: OrderedDict[str, SemanticModelDataSet] -) -> Sequence[BaseOutput]: - source_node_builder = SourceNodeBuilder(semantic_manifest_lookup) - return source_node_builder.create_from_data_sets(list(data_sets.values())) - - -def _build_time_spine_source_node(semantic_manifest_lookup: SemanticManifestLookup) -> MetricTimeDimensionTransformNode: - return SourceNodeBuilder.build_time_spine_source_node( - time_spine_source=semantic_manifest_lookup.time_spine_source, - data_set_converter=SemanticModelToDataSetConverter( - column_association_resolver=DunderColumnAssociationResolver(semantic_manifest_lookup) - ), - ) - - -def query_parser_from_yaml(yaml_contents: List[YamlConfigFile]) -> MetricFlowQueryParser: - """Given yaml files, return a query parser using default source nodes, resolvers and time spine source.""" - semantic_manifest_lookup = SemanticManifestLookup( - parse_yaml_files_to_validation_ready_semantic_manifest( - yaml_contents, apply_transformations=True - ).semantic_manifest - ) - SemanticManifestValidator[SemanticManifest]().checked_validations(semantic_manifest_lookup.semantic_manifest) - return MetricFlowQueryParser( - semantic_manifest_lookup=semantic_manifest_lookup, - ) - - -@dataclass(frozen=True) -class ConsistentIdObjectRepository: - """Stores all objects that should have consistent IDs in tests.""" - - simple_model_data_sets: OrderedDict[str, SemanticModelDataSet] - simple_model_read_nodes: OrderedDict[str, ReadSqlSourceNode] - simple_model_source_nodes: Sequence[BaseOutput] - simple_model_time_spine_source_node: MetricTimeDimensionTransformNode - - multihop_model_read_nodes: OrderedDict[str, ReadSqlSourceNode] - multihop_model_source_nodes: Sequence[BaseOutput] - multihop_model_time_spine_source_node: MetricTimeDimensionTransformNode - - scd_model_data_sets: OrderedDict[str, SemanticModelDataSet] - scd_model_read_nodes: OrderedDict[str, ReadSqlSourceNode] - scd_model_source_nodes: Sequence[BaseOutput] - scd_model_time_spine_source_node: MetricTimeDimensionTransformNode - - cyclic_join_read_nodes: OrderedDict[str, ReadSqlSourceNode] - cyclic_join_source_nodes: Sequence[BaseOutput] - cyclic_join_time_spine_source_node: MetricTimeDimensionTransformNode - - extended_date_model_read_nodes: OrderedDict[str, ReadSqlSourceNode] - extended_date_model_source_nodes: Sequence[BaseOutput] - extended_date_model_time_spine_source_node: MetricTimeDimensionTransformNode - - ambiguous_resolution_read_nodes: OrderedDict[str, ReadSqlSourceNode] - ambiguous_resolution_source_nodes: Sequence[BaseOutput] - ambiguous_resolution_time_spine_source_node: MetricTimeDimensionTransformNode - - -@pytest.fixture(scope="session") -def consistent_id_object_repository( - simple_semantic_manifest_lookup: SemanticManifestLookup, - partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup, - scd_semantic_manifest_lookup: SemanticManifestLookup, - cyclic_join_semantic_manifest_lookup: SemanticManifestLookup, - extended_date_semantic_manifest_lookup: SemanticManifestLookup, - ambiguous_resolution_manifest_lookup: SemanticManifestLookup, -) -> ConsistentIdObjectRepository: # noqa: D - """Create objects that have incremental numeric IDs with a consistent value. - - This should use IDs with a high enough value so that when other tests run with ID generators set to 0 at the start - of the test and create objects, there is no overlap in the IDs. - """ - with patch_id_generators_helper(start_value=IdNumberSpace.CONSISTENT_ID_REPOSITORY): - sm_data_sets = create_data_sets(simple_semantic_manifest_lookup) - multihop_data_sets = create_data_sets(partitioned_multi_hop_join_semantic_manifest_lookup) - scd_data_sets = create_data_sets(scd_semantic_manifest_lookup) - cyclic_join_data_sets = create_data_sets(cyclic_join_semantic_manifest_lookup) - extended_date_data_sets = create_data_sets(extended_date_semantic_manifest_lookup) - ambiguous_resolution_data_sets = create_data_sets(ambiguous_resolution_manifest_lookup) - - return ConsistentIdObjectRepository( - simple_model_data_sets=sm_data_sets, - simple_model_read_nodes=_data_set_to_read_nodes(sm_data_sets), - simple_model_source_nodes=_data_set_to_source_nodes(simple_semantic_manifest_lookup, sm_data_sets), - simple_model_time_spine_source_node=_build_time_spine_source_node(simple_semantic_manifest_lookup), - multihop_model_read_nodes=_data_set_to_read_nodes(multihop_data_sets), - multihop_model_source_nodes=_data_set_to_source_nodes( - partitioned_multi_hop_join_semantic_manifest_lookup, multihop_data_sets - ), - multihop_model_time_spine_source_node=_build_time_spine_source_node( - partitioned_multi_hop_join_semantic_manifest_lookup - ), - scd_model_data_sets=scd_data_sets, - scd_model_read_nodes=_data_set_to_read_nodes(scd_data_sets), - scd_model_source_nodes=_data_set_to_source_nodes( - semantic_manifest_lookup=scd_semantic_manifest_lookup, data_sets=scd_data_sets - ), - scd_model_time_spine_source_node=_build_time_spine_source_node(scd_semantic_manifest_lookup), - cyclic_join_read_nodes=_data_set_to_read_nodes(cyclic_join_data_sets), - cyclic_join_source_nodes=_data_set_to_source_nodes( - semantic_manifest_lookup=cyclic_join_semantic_manifest_lookup, data_sets=cyclic_join_data_sets - ), - cyclic_join_time_spine_source_node=_build_time_spine_source_node(cyclic_join_semantic_manifest_lookup), - extended_date_model_read_nodes=_data_set_to_read_nodes(extended_date_data_sets), - extended_date_model_source_nodes=_data_set_to_source_nodes( - semantic_manifest_lookup=extended_date_semantic_manifest_lookup, data_sets=extended_date_data_sets - ), - extended_date_model_time_spine_source_node=_build_time_spine_source_node( - extended_date_semantic_manifest_lookup - ), - ambiguous_resolution_read_nodes=_data_set_to_read_nodes(ambiguous_resolution_data_sets), - ambiguous_resolution_source_nodes=_data_set_to_source_nodes( - semantic_manifest_lookup=ambiguous_resolution_manifest_lookup, data_sets=ambiguous_resolution_data_sets - ), - ambiguous_resolution_time_spine_source_node=_build_time_spine_source_node( - ambiguous_resolution_manifest_lookup - ), - ) - - -def create_data_sets( - multihop_semantic_manifest_lookup: SemanticManifestLookup, -) -> OrderedDict[str, SemanticModelDataSet]: - """Convert the SemanticModels in the model to SqlDataSets. - - Key is the name of the semantic model, value is the associated data set. - """ - # Use ordered dict and sort by name to get consistency when running tests. - data_sets = OrderedDict() - semantic_models: Sequence[SemanticModel] = multihop_semantic_manifest_lookup.semantic_manifest.semantic_models - semantic_models = sorted(semantic_models, key=lambda x: x.name) - - converter = SemanticModelToDataSetConverter( - column_association_resolver=DunderColumnAssociationResolver(multihop_semantic_manifest_lookup) - ) - - for semantic_model in semantic_models: - data_sets[semantic_model.name] = converter.create_sql_source_data_set(semantic_model) - - return data_sets - - -def load_semantic_manifest( - relative_manifest_path: str, - template_mapping: Optional[Dict[str, str]] = None, -) -> SemanticManifestBuildResult: - """Reads the manifest YAMLs from the standard location, applies transformations, runs validations.""" - yaml_file_directory = os.path.join(os.path.dirname(__file__), f"semantic_manifest_yamls/{relative_manifest_path}") - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - yaml_file_directory, template_mapping=template_mapping - ) - validator = SemanticManifestValidator[PydanticSemanticManifest]() - validator.checked_validations(build_result.semantic_manifest) - return build_result - - -@pytest.fixture(scope="session") -def template_mapping(mf_test_session_state: MetricFlowTestSessionState) -> Dict[str, str]: - """Mapping for template variables in the model YAML files.""" - return {"source_schema": mf_test_session_state.mf_source_schema} - - -@pytest.fixture(scope="session") -def simple_semantic_manifest_lookup_non_ds(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = load_semantic_manifest("non_sm_manifest", template_mapping) - return SemanticManifestLookup(build_result.semantic_manifest) - - -@pytest.fixture(scope="session") -def simple_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = load_semantic_manifest("simple_manifest", template_mapping) - return SemanticManifestLookup(build_result.semantic_manifest) - - -@pytest.fixture(scope="session") -def partitioned_multi_hop_join_semantic_manifest_lookup( # noqa: D - template_mapping: Dict[str, str] -) -> SemanticManifestLookup: - build_result = load_semantic_manifest("partitioned_multi_hop_join_manifest", template_mapping) - return SemanticManifestLookup(build_result.semantic_manifest) - - -@pytest.fixture(scope="session") -def multi_hop_join_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = load_semantic_manifest("multi_hop_join_manifest", template_mapping) - return SemanticManifestLookup(build_result.semantic_manifest) - - -@pytest.fixture(scope="session") -def simple_semantic_manifest(template_mapping: Dict[str, str]) -> SemanticManifest: - """Model used for many tests.""" - build_result = load_semantic_manifest("simple_manifest", template_mapping) - return build_result.semantic_manifest - - -@pytest.fixture(scope="session") -def simple_model__with_primary_transforms(template_mapping: Dict[str, str]) -> SemanticManifest: - """Model used for tests pre-transformations.""" - build_result = load_semantic_manifest("simple_manifest", template_mapping) - transformed_model = PydanticSemanticManifestTransformer().transform( - model=build_result.semantic_manifest, - ordered_rule_sequences=(PydanticSemanticManifestTransformRuleSet().primary_rules,), - ) - return transformed_model - - -@pytest.fixture(scope="session") -def extended_date_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = load_semantic_manifest("extended_date_manifest", template_mapping) - return SemanticManifestLookup(build_result.semantic_manifest) - - -@pytest.fixture(scope="session") -def scd_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: - """Initialize semantic model for SCD tests.""" - build_result = load_semantic_manifest("scd_manifest", template_mapping) - return SemanticManifestLookup(build_result.semantic_manifest) - - -@pytest.fixture(scope="session") -def data_warehouse_validation_model(template_mapping: Dict[str, str]) -> SemanticManifest: - """Model used for data warehouse validation tests.""" - build_result = load_semantic_manifest("data_warehouse_validation_manifest", template_mapping) - return build_result.semantic_manifest - - -@pytest.fixture(scope="session") -def cyclic_join_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: - """Manifest that contains a potential cycle in the join graph (if not handled properly).""" - build_result = load_semantic_manifest("cyclic_join_manifest", template_mapping) - return SemanticManifestLookup(build_result.semantic_manifest) - - -@pytest.fixture(scope="session") -def node_output_resolver( # noqa:D - simple_semantic_manifest_lookup: SemanticManifestLookup, -) -> DataflowPlanNodeOutputDataSetResolver: - return DataflowPlanNodeOutputDataSetResolver( - column_association_resolver=DunderColumnAssociationResolver(simple_semantic_manifest_lookup), - semantic_manifest_lookup=simple_semantic_manifest_lookup, - ) - - -@pytest.fixture(scope="session") -def ambiguous_resolution_manifest(template_mapping: Dict[str, str]) -> PydanticSemanticManifest: - """Manifest used to test ambiguous resolution of group-by-items.""" - build_result = load_semantic_manifest("ambiguous_resolution_manifest", template_mapping) - return build_result.semantic_manifest - - -@pytest.fixture(scope="session") -def ambiguous_resolution_manifest_lookup( # noqa: D - ambiguous_resolution_manifest: PydanticSemanticManifest, -) -> SemanticManifestLookup: - return SemanticManifestLookup(ambiguous_resolution_manifest) - - -@pytest.fixture(scope="session") -def simple_multi_hop_join_manifest(template_mapping: Dict[str, str]) -> PydanticSemanticManifest: # noqa: D - build_result = load_semantic_manifest("simple_multi_hop_join_manifest", template_mapping) - return build_result.semantic_manifest - - -@pytest.fixture(scope="session") -def simple_multi_hop_join_manifest_lookup( # noqa: D - simple_multi_hop_join_manifest: PydanticSemanticManifest, -) -> SemanticManifestLookup: - """Manifest used to test ambiguous resolution of group-by-items.""" - return SemanticManifestLookup(simple_multi_hop_join_manifest) diff --git a/metricflow/test/fixtures/sql_fixtures.py b/metricflow/test/fixtures/sql_fixtures.py index bd69ca0f34..c346e58005 100644 --- a/metricflow/test/fixtures/sql_fixtures.py +++ b/metricflow/test/fixtures/sql_fixtures.py @@ -1,11 +1,12 @@ from __future__ import annotations +from typing import Mapping + import pytest -from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup -from metricflow.plan_conversion.column_resolver import DunderColumnAssociationResolver from metricflow.plan_conversion.dataflow_to_sql import DataflowToSqlQueryPlanConverter from metricflow.sql.render.sql_plan_renderer import DefaultSqlQueryPlanRenderer, SqlQueryPlanRenderer +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup @pytest.fixture @@ -15,19 +16,29 @@ def default_sql_plan_renderer() -> SqlQueryPlanRenderer: # noqa: D @pytest.fixture(scope="session") def dataflow_to_sql_converter( # noqa: D - simple_semantic_manifest_lookup: SemanticManifestLookup, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> DataflowToSqlQueryPlanConverter: - return DataflowToSqlQueryPlanConverter( - column_association_resolver=DunderColumnAssociationResolver(simple_semantic_manifest_lookup), - semantic_manifest_lookup=simple_semantic_manifest_lookup, - ) + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].dataflow_to_sql_converter @pytest.fixture(scope="session") def extended_date_dataflow_to_sql_converter( # noqa: D - extended_date_semantic_manifest_lookup: SemanticManifestLookup, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> DataflowToSqlQueryPlanConverter: + return mf_engine_test_fixture_mapping[SemanticManifestSetup.EXTENDED_DATE_MANIFEST].dataflow_to_sql_converter + + +@pytest.fixture(scope="session") +def multihop_dataflow_to_sql_converter( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] +) -> DataflowToSqlQueryPlanConverter: + return mf_engine_test_fixture_mapping[ + SemanticManifestSetup.PARTITIONED_MULTI_HOP_JOIN_MANIFEST + ].dataflow_to_sql_converter + + +@pytest.fixture(scope="session") +def scd_dataflow_to_sql_converter( # noqa: D + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture] ) -> DataflowToSqlQueryPlanConverter: - return DataflowToSqlQueryPlanConverter( - column_association_resolver=DunderColumnAssociationResolver(extended_date_semantic_manifest_lookup), - semantic_manifest_lookup=extended_date_semantic_manifest_lookup, - ) + return mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].dataflow_to_sql_converter diff --git a/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py b/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py index 3de2a61149..2f7814c9fa 100644 --- a/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py +++ b/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, Sequence +from typing import Dict, Mapping, Sequence from dbt_semantic_interfaces.enum_extension import assert_values_exhausted from dbt_semantic_interfaces.protocols.entity import EntityType @@ -13,7 +13,7 @@ SemanticModelJoinEvaluator, SemanticModelLink, ) -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup def _get_join_types_for_entity_type(entity_type: EntityType) -> Sequence[SemanticModelEntityJoinType]: @@ -208,13 +208,23 @@ def test_semantic_model_join_validation_on_missing_entity( def test_distinct_target_instance_set_join_validation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests instance set join validation to a PRIMARY or UNIQUE entity.""" - foreign_user_instance_set = consistent_id_object_repository.simple_model_data_sets["listings_latest"].instance_set - primary_user_instance_set = consistent_id_object_repository.simple_model_data_sets["users_latest"].instance_set - unique_user_instance_set = consistent_id_object_repository.simple_model_data_sets["companies"].instance_set + foreign_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST] + .data_set_mapping["listings_latest"] + .instance_set + ) + primary_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST] + .data_set_mapping["users_latest"] + .instance_set + ) + unique_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].data_set_mapping["companies"].instance_set + ) user_entity_reference = EntityReference(element_name="user") join_evaluator = SemanticModelJoinEvaluator( semantic_model_lookup=simple_semantic_manifest_lookup.semantic_model_lookup @@ -266,13 +276,23 @@ def test_distinct_target_instance_set_join_validation( def test_foreign_target_instance_set_join_validation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests semantic model join validation to FOREIGN entity types.""" - foreign_user_instance_set = consistent_id_object_repository.simple_model_data_sets["listings_latest"].instance_set - primary_user_instance_set = consistent_id_object_repository.simple_model_data_sets["users_latest"].instance_set - unique_user_instance_set = consistent_id_object_repository.simple_model_data_sets["companies"].instance_set + foreign_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST] + .data_set_mapping["listings_latest"] + .instance_set + ) + primary_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST] + .data_set_mapping["users_latest"] + .instance_set + ) + unique_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].data_set_mapping["companies"].instance_set + ) user_entity_reference = EntityReference(element_name="user") join_evaluator = SemanticModelJoinEvaluator( semantic_model_lookup=simple_semantic_manifest_lookup.semantic_model_lookup @@ -481,16 +501,29 @@ def test_natural_entity_semantic_model_validation(scd_semantic_manifest_lookup: def test_natural_entity_instance_set_validation( - consistent_id_object_repository: ConsistentIdObjectRepository, scd_semantic_manifest_lookup: SemanticManifestLookup + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], + scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests instance set validation for NATURAL target entity types. These tests rely on the scd_semantic_manifest_lookup, which makes extensive use of NATURAL key types. """ - natural_user_instance_set = consistent_id_object_repository.scd_model_data_sets["primary_accounts"].instance_set - primary_user_instance_set = consistent_id_object_repository.scd_model_data_sets["users_latest"].instance_set - foreign_user_instance_set = consistent_id_object_repository.scd_model_data_sets["bookings_source"].instance_set - unique_user_instance_set = consistent_id_object_repository.scd_model_data_sets["companies"].instance_set + natural_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST] + .data_set_mapping["primary_accounts"] + .instance_set + ) + primary_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].data_set_mapping["users_latest"].instance_set + ) + foreign_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST] + .data_set_mapping["bookings_source"] + .instance_set + ) + unique_user_instance_set = ( + mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].data_set_mapping["companies"].instance_set + ) user_entity_reference = EntityReference(element_name="user") join_evaluator = SemanticModelJoinEvaluator( semantic_model_lookup=scd_semantic_manifest_lookup.semantic_model_lookup diff --git a/metricflow/test/plan_conversion/dataflow_to_sql/test_metric_time_dimension_to_sql.py b/metricflow/test/plan_conversion/dataflow_to_sql/test_metric_time_dimension_to_sql.py index f42c0dfae7..72482be736 100644 --- a/metricflow/test/plan_conversion/dataflow_to_sql/test_metric_time_dimension_to_sql.py +++ b/metricflow/test/plan_conversion/dataflow_to_sql/test_metric_time_dimension_to_sql.py @@ -1,5 +1,7 @@ from __future__ import annotations +from typing import Mapping + import pytest from _pytest.fixtures import FixtureRequest from dbt_semantic_interfaces.references import TimeDimensionReference @@ -9,7 +11,7 @@ from metricflow.plan_conversion.dataflow_to_sql import DataflowToSqlQueryPlanConverter from metricflow.protocols.sql_client import SqlClient from metricflow.specs.specs import MetricFlowQuerySpec, MetricSpec -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.plan_conversion.test_dataflow_to_sql_plan import convert_and_check from metricflow.test.time.metric_time_dimension import MTD_SPEC_DAY @@ -20,11 +22,13 @@ def test_metric_time_dimension_transform_node_using_primary_time( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a PlotTimeDimensionTransform node using the primary time dimension to SQL.""" - source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] metric_time_dimension_transform_node = MetricTimeDimensionTransformNode( parent_node=source_node, aggregation_time_dimension_reference=TimeDimensionReference(element_name="ds") ) @@ -42,11 +46,13 @@ def test_metric_time_dimension_transform_node_using_non_primary_time( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a PlotTimeDimensionTransform node using a non-primary time dimension to SQL.""" - source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] metric_time_dimension_transform_node = MetricTimeDimensionTransformNode( parent_node=source_node, aggregation_time_dimension_reference=TimeDimensionReference(element_name="paid_at"), @@ -65,7 +71,7 @@ def test_simple_query_with_metric_time_dimension( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, dataflow_plan_builder: DataflowPlanBuilder, ) -> None: diff --git a/metricflow/test/plan_conversion/instance_converters/test_create_select_columns_with_measures_aggregated.py b/metricflow/test/plan_conversion/instance_converters/test_create_select_columns_with_measures_aggregated.py index 79eb4ad368..67dc979f7b 100644 --- a/metricflow/test/plan_conversion/instance_converters/test_create_select_columns_with_measures_aggregated.py +++ b/metricflow/test/plan_conversion/instance_converters/test_create_select_columns_with_measures_aggregated.py @@ -1,5 +1,7 @@ from __future__ import annotations +from typing import Mapping + from metricflow.instances import InstanceSet from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup from metricflow.plan_conversion.column_resolver import DunderColumnAssociationResolver @@ -14,16 +16,20 @@ SqlFunction, SqlPercentileExpression, ) -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup __SOURCE_TABLE_ALIAS = "a" def __get_filtered_measure_instance_set( - semantic_model_name: str, measure_name: str, object_repo: ConsistentIdObjectRepository + semantic_model_name: str, + measure_name: str, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], ) -> InstanceSet: """Gets an InstanceSet consisting of only the measure instance matching the given name and semantic model.""" - dataset = object_repo.simple_model_data_sets[semantic_model_name] + dataset = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].data_set_mapping[ + semantic_model_name + ] instance_set = dataset.instance_set include_specs = tuple( instance.spec for instance in instance_set.measure_instances if instance.spec.element_name == measure_name @@ -32,12 +38,12 @@ def __get_filtered_measure_instance_set( def test_sum_aggregation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for booking_value, a SUM type metric in the simple model.""" measure_name = "booking_value" - instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, @@ -54,12 +60,12 @@ def test_sum_aggregation( def test_sum_boolean_aggregation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for instant_bookings, a SUM_BOOLEAN type metric in the simple model.""" measure_name = "instant_bookings" - instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, @@ -77,12 +83,12 @@ def test_sum_boolean_aggregation( def test_avg_aggregation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for average_booking_value, an AVG type metric in the simple model.""" measure_name = "average_booking_value" - instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, @@ -99,12 +105,12 @@ def test_avg_aggregation( def test_count_distinct_aggregation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for bookers, a COUNT_DISTINCT type metric in the simple model.""" measure_name = "bookers" - instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, @@ -121,12 +127,12 @@ def test_count_distinct_aggregation( def test_max_aggregation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for largest_listing, a MAX type metric in the simple model.""" measure_name = "largest_listing" - instance_set = __get_filtered_measure_instance_set("listings_latest", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("listings_latest", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, @@ -143,12 +149,12 @@ def test_max_aggregation( def test_min_aggregation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for smallest_listing, a MIN type metric in the simple model.""" measure_name = "smallest_listing" - instance_set = __get_filtered_measure_instance_set("listings_latest", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("listings_latest", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, @@ -165,12 +171,12 @@ def test_min_aggregation( def test_aliased_sum( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for booking_value, a SUM type metric in the simple model, with an alias.""" measure_name = "booking_value" - instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, @@ -188,12 +194,12 @@ def test_aliased_sum( def test_percentile_aggregation( - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], simple_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Checks for function expression handling for booking_value, a percentile type metric in the simple model.""" measure_name = "booking_value_p99" - instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, consistent_id_object_repository) + instance_set = __get_filtered_measure_instance_set("bookings_source", measure_name, mf_engine_test_fixture_mapping) select_column_set: SelectColumnSet = CreateSelectColumnsWithMeasuresAggregated( __SOURCE_TABLE_ALIAS, diff --git a/metricflow/test/plan_conversion/instance_converters/test_create_validity_window_join_description.py b/metricflow/test/plan_conversion/instance_converters/test_create_validity_window_join_description.py index 6a2b7572c2..6ac0b66e03 100644 --- a/metricflow/test/plan_conversion/instance_converters/test_create_validity_window_join_description.py +++ b/metricflow/test/plan_conversion/instance_converters/test_create_validity_window_join_description.py @@ -1,5 +1,7 @@ from __future__ import annotations +from typing import Mapping + import pytest from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity @@ -8,15 +10,16 @@ from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup from metricflow.plan_conversion.instance_converters import CreateValidityWindowJoinDescription from metricflow.specs.specs import TimeDimensionSpec -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup def test_no_validity_dims( - consistent_id_object_repository: ConsistentIdObjectRepository, scd_semantic_manifest_lookup: SemanticManifestLookup + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], + scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests converting an instance set with no matching dimensions to a ValidityWindowJoinDescription.""" # bookings_source is a fact table, and has no validity window dimensions - dataset = consistent_id_object_repository.scd_model_data_sets["bookings_source"] + dataset = mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].data_set_mapping["bookings_source"] validity_window_join_description = CreateValidityWindowJoinDescription( semantic_model_lookup=scd_semantic_manifest_lookup.semantic_model_lookup @@ -29,11 +32,12 @@ def test_no_validity_dims( def test_validity_window_conversion( - consistent_id_object_repository: ConsistentIdObjectRepository, scd_semantic_manifest_lookup: SemanticManifestLookup + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], + scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests converting an instance set with a single validity window into a ValidityWindowJoinDescription.""" # The listings semantic model uses a 2-column SCD Type III layout - dataset = consistent_id_object_repository.scd_model_data_sets["listings"] + dataset = mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].data_set_mapping["listings"] expected_join_description = ValidityWindowJoinDescription( window_start_dimension=TimeDimensionSpec( element_name="window_start", @@ -58,11 +62,14 @@ def test_validity_window_conversion( def test_multiple_validity_windows( - consistent_id_object_repository: ConsistentIdObjectRepository, scd_semantic_manifest_lookup: SemanticManifestLookup + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], + scd_semantic_manifest_lookup: SemanticManifestLookup, ) -> None: """Tests the behavior of this converter when it encounters an instance set with multiple validity windows.""" - first_dataset = consistent_id_object_repository.scd_model_data_sets["listings"] - second_dataset = consistent_id_object_repository.scd_model_data_sets["primary_accounts"] + first_dataset = mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].data_set_mapping["listings"] + second_dataset = mf_engine_test_fixture_mapping[SemanticManifestSetup.SCD_MANIFEST].data_set_mapping[ + "primary_accounts" + ] merged_instance_set = InstanceSet.merge([first_dataset.instance_set, second_dataset.instance_set]) with pytest.raises(AssertionError, match="Found more than 1 set of validity window specs"): CreateValidityWindowJoinDescription( 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 b28cd802f0..da2b61d3b4 100644 --- a/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py +++ b/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import List +from typing import List, Mapping import pytest from _pytest.fixtures import FixtureRequest @@ -51,7 +51,7 @@ from metricflow.sql.sql_bind_parameters import SqlBindParameters from metricflow.sql.sql_plan import SqlJoinType from metricflow.test.dataflow_plan_to_svg import display_graph_if_requested -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState 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 @@ -120,11 +120,13 @@ def test_source_node( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a single source node.""" - source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] convert_and_check( request=request, @@ -140,14 +142,16 @@ def test_filter_node( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a leaf pass filter node.""" measure_spec = MeasureSpec( element_name="bookings", ) - source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filter_node = FilterElementsNode( parent_node=source_node, include_specs=InstanceSpecSet(measure_specs=(measure_spec,)) ) @@ -167,14 +171,16 @@ def test_filter_with_where_constraint_node( # noqa: D mf_test_session_state: MetricFlowTestSessionState, column_association_resolver: ColumnAssociationResolver, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a leaf pass filter node.""" measure_spec = MeasureSpec( element_name="bookings", ) - source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] ds_spec = TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY) filter_node = FilterElementsNode( @@ -212,7 +218,7 @@ def test_measure_aggregation_node( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a leaf measure aggregation node. @@ -234,7 +240,9 @@ def test_measure_aggregation_node( # noqa: D measure_specs: List[MeasureSpec] = [sum_spec, sum_boolean_spec, avg_spec, count_distinct_spec] metric_input_measure_specs = tuple(MetricInputMeasureSpec(measure_spec=x) for x in measure_specs) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measure_node = FilterElementsNode( parent_node=measure_source_node, include_specs=InstanceSpecSet(measure_specs=tuple(measure_specs)), @@ -258,7 +266,7 @@ def test_single_join_node( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a join between 1 measure and 1 dimension.""" @@ -266,7 +274,9 @@ def test_single_join_node( # noqa: D element_name="bookings", ) entity_spec = LinklessEntitySpec.from_element_name(element_name="listing") - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measure_node = FilterElementsNode( parent_node=measure_source_node, include_specs=InstanceSpecSet( @@ -279,7 +289,9 @@ def test_single_join_node( # noqa: D element_name="country_latest", entity_links=(EntityReference("listing"),), ) - dimension_source_node = consistent_id_object_repository.simple_model_read_nodes["listings_latest"] + dimension_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ] filtered_dimension_node = FilterElementsNode( parent_node=dimension_source_node, include_specs=InstanceSpecSet( @@ -315,7 +327,7 @@ def test_multi_join_node( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a join between 1 measure and 2 dimensions.""" @@ -323,7 +335,9 @@ def test_multi_join_node( element_name="bookings", ) entity_spec = LinklessEntitySpec.from_element_name(element_name="listing") - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measure_node = FilterElementsNode( parent_node=measure_source_node, include_specs=InstanceSpecSet(measure_specs=(measure_spec,), entity_specs=(entity_spec,)), @@ -333,7 +347,9 @@ def test_multi_join_node( element_name="country_latest", entity_links=(), ) - dimension_source_node = consistent_id_object_repository.simple_model_read_nodes["listings_latest"] + dimension_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ] filtered_dimension_node = FilterElementsNode( parent_node=dimension_source_node, include_specs=InstanceSpecSet( @@ -376,7 +392,7 @@ def test_compute_metrics_node( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a leaf compute metrics node.""" @@ -385,7 +401,9 @@ def test_compute_metrics_node( ) entity_spec = LinklessEntitySpec.from_element_name(element_name="listing") metric_input_measure_specs = (MetricInputMeasureSpec(measure_spec=measure_spec),) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measure_node = FilterElementsNode( parent_node=measure_source_node, include_specs=InstanceSpecSet( @@ -398,7 +416,9 @@ def test_compute_metrics_node( element_name="country_latest", entity_links=(), ) - dimension_source_node = consistent_id_object_repository.simple_model_read_nodes["listings_latest"] + dimension_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ] filtered_dimension_node = FilterElementsNode( parent_node=dimension_source_node, include_specs=InstanceSpecSet( @@ -441,7 +461,7 @@ def test_compute_metrics_node_simple_expr( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests the compute metrics node for expr type metrics sourced from a single measure.""" @@ -450,7 +470,9 @@ def test_compute_metrics_node_simple_expr( ) entity_spec = LinklessEntitySpec.from_element_name(element_name="listing") metric_input_measure_specs = (MetricInputMeasureSpec(measure_spec=measure_spec),) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measure_node = FilterElementsNode( parent_node=measure_source_node, include_specs=InstanceSpecSet(measure_specs=(measure_spec,), entity_specs=(entity_spec,)), @@ -460,7 +482,9 @@ def test_compute_metrics_node_simple_expr( element_name="country_latest", entity_links=(), ) - dimension_source_node = consistent_id_object_repository.simple_model_read_nodes["listings_latest"] + dimension_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ] filtered_dimension_node = FilterElementsNode( parent_node=dimension_source_node, include_specs=InstanceSpecSet( @@ -518,7 +542,7 @@ def test_join_to_time_spine_node_without_offset( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests JoinToTimeSpineNode for a single metric with offset_window.""" @@ -528,7 +552,9 @@ def test_join_to_time_spine_node_without_offset( # noqa: D metric_time_spec = TimeDimensionSpec( element_name="metric_time", entity_links=(), time_granularity=TimeGranularity.DAY ) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] metric_time_node = MetricTimeDimensionTransformNode( parent_node=measure_source_node, aggregation_time_dimension_reference=TimeDimensionReference(element_name="ds"), @@ -584,7 +610,7 @@ def test_join_to_time_spine_node_with_offset_window( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests JoinToTimeSpineNode for a single metric with offset_window.""" @@ -594,7 +620,9 @@ def test_join_to_time_spine_node_with_offset_window( # noqa: D metric_time_spec = TimeDimensionSpec( element_name="metric_time", entity_links=(), time_granularity=TimeGranularity.DAY ) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] metric_time_node = MetricTimeDimensionTransformNode( parent_node=measure_source_node, aggregation_time_dimension_reference=TimeDimensionReference(element_name="ds"), @@ -651,7 +679,7 @@ def test_join_to_time_spine_node_with_offset_to_grain( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests JoinToTimeSpineNode for a single metric with offset_to_grain.""" @@ -661,7 +689,9 @@ def test_join_to_time_spine_node_with_offset_to_grain( metric_time_spec = TimeDimensionSpec( element_name="metric_time", entity_links=(), time_granularity=TimeGranularity.DAY ) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] metric_time_node = MetricTimeDimensionTransformNode( parent_node=measure_source_node, aggregation_time_dimension_reference=TimeDimensionReference(element_name="ds"), @@ -719,7 +749,7 @@ def test_compute_metrics_node_ratio_from_single_semantic_model( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests the compute metrics node for ratio type metrics sourced from a single semantic model.""" @@ -734,7 +764,9 @@ def test_compute_metrics_node_ratio_from_single_semantic_model( MetricInputMeasureSpec(measure_spec=numerator_spec), MetricInputMeasureSpec(measure_spec=denominator_spec), ) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measures_node = FilterElementsNode( parent_node=measure_source_node, include_specs=InstanceSpecSet(measure_specs=(numerator_spec, denominator_spec), entity_specs=(entity_spec,)), @@ -744,7 +776,9 @@ def test_compute_metrics_node_ratio_from_single_semantic_model( element_name="country_latest", entity_links=(), ) - dimension_source_node = consistent_id_object_repository.simple_model_read_nodes["listings_latest"] + dimension_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "listings_latest" + ] filtered_dimension_node = FilterElementsNode( parent_node=dimension_source_node, include_specs=InstanceSpecSet( @@ -785,7 +819,7 @@ def test_compute_metrics_node_ratio_from_single_semantic_model( def test_order_by_node( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, sql_client: SqlClient, ) -> None: @@ -804,7 +838,9 @@ def test_order_by_node( element_name="ds", entity_links=(), ) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measure_node = FilterElementsNode( parent_node=measure_source_node, @@ -849,7 +885,7 @@ def test_order_by_node( def test_semi_additive_join_node( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, sql_client: SqlClient, ) -> None: @@ -857,7 +893,9 @@ def test_semi_additive_join_node( non_additive_dimension_spec = NonAdditiveDimensionSpec(name="ds", window_choice=AggregationType.MIN) time_dimension_spec = TimeDimensionSpec(element_name="ds", entity_links=()) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["accounts_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "accounts_source" + ] semi_additive_join_node = SemiAdditiveJoinNode( parent_node=measure_source_node, entity_specs=tuple(), @@ -878,7 +916,7 @@ def test_semi_additive_join_node( def test_semi_additive_join_node_with_queried_group_by( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, sql_client: SqlClient, ) -> None: @@ -889,7 +927,9 @@ def test_semi_additive_join_node_with_queried_group_by( element_name="ds", entity_links=(), time_granularity=TimeGranularity.WEEK ) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["accounts_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "accounts_source" + ] semi_additive_join_node = SemiAdditiveJoinNode( parent_node=measure_source_node, entity_specs=tuple(), @@ -910,7 +950,7 @@ def test_semi_additive_join_node_with_queried_group_by( def test_semi_additive_join_node_with_grouping( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, sql_client: SqlClient, ) -> None: @@ -923,7 +963,9 @@ def test_semi_additive_join_node_with_grouping( entity_spec = LinklessEntitySpec(element_name="user", entity_links=()) time_dimension_spec = TimeDimensionSpec(element_name="ds", entity_links=()) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["accounts_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "accounts_source" + ] semi_additive_join_node = SemiAdditiveJoinNode( parent_node=measure_source_node, entity_specs=(entity_spec,), @@ -943,12 +985,14 @@ def test_semi_additive_join_node_with_grouping( def test_constrain_time_range_node( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, sql_client: SqlClient, ) -> None: """Tests converting the ConstrainTimeRangeNode to SQL.""" - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] filtered_measure_node = FilterElementsNode( parent_node=measure_source_node, include_specs=InstanceSpecSet( @@ -1025,7 +1069,7 @@ def test_combine_output_node( # noqa: D request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests combining AggregateMeasuresNode.""" @@ -1042,7 +1086,9 @@ def test_combine_output_node( # noqa: D element_name="is_instant", entity_links=(), ) - measure_source_node = consistent_id_object_repository.simple_model_read_nodes["bookings_source"] + measure_source_node = mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].read_node_mapping[ + "bookings_source" + ] # Build compute measures node measure_specs: List[MeasureSpec] = [sum_spec] diff --git a/metricflow/test/query/test_query_parser.py b/metricflow/test/query/test_query_parser.py index 837728945a..77a43838d8 100644 --- a/metricflow/test/query/test_query_parser.py +++ b/metricflow/test/query/test_query_parser.py @@ -2,15 +2,20 @@ import logging import textwrap +from typing import List import pytest +from dbt_semantic_interfaces.parsing.dir_to_model import parse_yaml_files_to_validation_ready_semantic_manifest from dbt_semantic_interfaces.parsing.objects import YamlConfigFile +from dbt_semantic_interfaces.protocols import SemanticManifest from dbt_semantic_interfaces.references import EntityReference from dbt_semantic_interfaces.test_utils import as_datetime from dbt_semantic_interfaces.type_enums.date_part import DatePart from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity +from dbt_semantic_interfaces.validations.semantic_manifest_validator import SemanticManifestValidator from metricflow.filters.time_constraint import TimeRangeConstraint +from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup from metricflow.query.query_exceptions import InvalidQueryException from metricflow.query.query_parser import MetricFlowQueryParser from metricflow.specs.query_param_implementations import ( @@ -26,7 +31,6 @@ OrderBySpec, TimeDimensionSpec, ) -from metricflow.test.fixtures.model_fixtures import query_parser_from_yaml from metricflow.test.model.example_project_configuration import EXAMPLE_PROJECT_CONFIGURATION_YAML_CONFIG_FILE from metricflow.test.time.metric_time_dimension import MTD @@ -621,3 +625,16 @@ def test_offset_metric_with_diff_agg_time_dims_error() -> None: # noqa: D metric_names=["monthly_revenue_last_7_days"], group_by_names=["revenue___ds"], ) + + +def query_parser_from_yaml(yaml_contents: List[YamlConfigFile]) -> MetricFlowQueryParser: + """Given yaml files, return a query parser using default source nodes, resolvers and time spine source.""" + semantic_manifest_lookup = SemanticManifestLookup( + parse_yaml_files_to_validation_ready_semantic_manifest( + yaml_contents, apply_transformations=True + ).semantic_manifest + ) + SemanticManifestValidator[SemanticManifest]().checked_validations(semantic_manifest_lookup.semantic_manifest) + return MetricFlowQueryParser( + semantic_manifest_lookup=semantic_manifest_lookup, + ) diff --git a/metricflow/test/query_rendering/test_cumulative_metric_rendering.py b/metricflow/test/query_rendering/test_cumulative_metric_rendering.py index 6391c434e4..65b0e8f774 100644 --- a/metricflow/test/query_rendering/test_cumulative_metric_rendering.py +++ b/metricflow/test/query_rendering/test_cumulative_metric_rendering.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing import Mapping + import pytest from _pytest.fixtures import FixtureRequest from dbt_semantic_interfaces.implementations.filters.where_filter import PydanticWhereFilter @@ -16,7 +18,7 @@ from metricflow.query.query_parser import MetricFlowQueryParser from metricflow.specs.column_assoc import ColumnAssociationResolver from metricflow.specs.specs import EntityReference, MetricFlowQuerySpec, MetricSpec, TimeDimensionSpec -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.query_rendering.compare_rendered_query import convert_and_check from metricflow.test.time.metric_time_dimension import MTD_SPEC_MONTH @@ -28,7 +30,7 @@ def test_cumulative_metric( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a basic cumulative metric query.""" @@ -61,7 +63,7 @@ def test_cumulative_metric_with_time_constraint( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a cumulative metric query with an adjustable time constraint. @@ -104,7 +106,7 @@ def test_cumulative_metric_with_non_adjustable_time_filter( query_parser: MetricFlowQueryParser, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a cumulative metric query with a time filter that cannot be automatically adjusted. @@ -140,7 +142,7 @@ def test_cumulative_metric_no_ds( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a cumulative metric with no time dimension specified.""" @@ -167,7 +169,7 @@ def test_cumulative_metric_no_window( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a query where there is a windowless cumulative metric to compute.""" @@ -200,7 +202,7 @@ def test_cumulative_metric_no_window_with_time_constraint( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a query for a windowless cumulative metric query with an adjustable time constraint.""" @@ -230,7 +232,7 @@ def test_cumulative_metric_grain_to_date( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a query against a grain_to_date cumulative metric.""" @@ -263,7 +265,7 @@ def test_cumulative_metric_month( mf_test_session_state: MetricFlowTestSessionState, extended_date_dataflow_plan_builder: DataflowPlanBuilder, extended_date_dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a query for a cumulative metric based on a monthly time dimension.""" @@ -293,7 +295,7 @@ def test_cumulative_metric_with_agg_time_dimension( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], sql_client: SqlClient, ) -> None: """Tests rendering a query for a cumulative metric queried with agg time dimension.""" diff --git a/metricflow/test/query_rendering/test_query_rendering.py b/metricflow/test/query_rendering/test_query_rendering.py index 5ccb2aba3a..0dabdc824b 100644 --- a/metricflow/test/query_rendering/test_query_rendering.py +++ b/metricflow/test/query_rendering/test_query_rendering.py @@ -1,7 +1,7 @@ """Tests base query rendering behavior by comparing rendered output against snapshot files. This module is meant to start with a MetricFlowQuerySpec or equivalent representation of -a MetricFlow query input and end up with a query rendered for execution against a the +a MetricFlow query input and end up with a query rendered for execution against the target engine. This will depend on test semantic manifests and engine-specific rendering logic as propagated via the SqlClient input. """ @@ -18,8 +18,6 @@ from metricflow.dataflow.builder.dataflow_plan_builder import DataflowPlanBuilder from metricflow.dataset.dataset import DataSet from metricflow.filters.time_constraint import TimeRangeConstraint -from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup -from metricflow.plan_conversion.column_resolver import DunderColumnAssociationResolver from metricflow.plan_conversion.dataflow_to_sql import DataflowToSqlQueryPlanConverter from metricflow.protocols.sql_client import SqlClient from metricflow.query.query_parser import MetricFlowQueryParser @@ -30,34 +28,11 @@ MetricSpec, TimeDimensionSpec, ) -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.query_rendering.compare_rendered_query import convert_and_check from metricflow.test.time.metric_time_dimension import MTD_SPEC_DAY -@pytest.fixture(scope="session") -def multihop_dataflow_to_sql_converter( # noqa: D - partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup, -) -> DataflowToSqlQueryPlanConverter: - return DataflowToSqlQueryPlanConverter( - column_association_resolver=DunderColumnAssociationResolver( - partitioned_multi_hop_join_semantic_manifest_lookup - ), - semantic_manifest_lookup=partitioned_multi_hop_join_semantic_manifest_lookup, - ) - - -@pytest.fixture(scope="session") -def scd_dataflow_to_sql_converter( # noqa: D - scd_semantic_manifest_lookup: SemanticManifestLookup, -) -> DataflowToSqlQueryPlanConverter: - return DataflowToSqlQueryPlanConverter( - column_association_resolver=DunderColumnAssociationResolver(scd_semantic_manifest_lookup), - semantic_manifest_lookup=scd_semantic_manifest_lookup, - ) - - @pytest.mark.sql_engine_snapshot def test_multihop_node( request: FixtureRequest, @@ -95,11 +70,9 @@ def test_multihop_node( def test_filter_with_where_constraint_on_join_dim( request: FixtureRequest, mf_test_session_state: MetricFlowTestSessionState, - column_association_resolver: ColumnAssociationResolver, dataflow_plan_builder: DataflowPlanBuilder, query_parser: MetricFlowQueryParser, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan to a SQL query plan where there is a join between 1 measure and 2 dimensions.""" @@ -127,7 +100,6 @@ def test_partitioned_join( mf_test_session_state: MetricFlowTestSessionState, dataflow_plan_builder: DataflowPlanBuilder, dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - consistent_id_object_repository: ConsistentIdObjectRepository, sql_client: SqlClient, ) -> None: """Tests converting a dataflow plan where there's a join on a partitioned dimension.""" diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql index 47735bf985..f2c62d3757 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC(buys_source_src_10002.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_10002.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS buy__ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql index 22380129b4..cd16ddbf70 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql index 32e2afb72c..3a164d16c2 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql @@ -66,36 +66,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -184,36 +184,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -306,34 +306,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC(buys_source_src_10002.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_10002.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS buy__ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql index 7b73e61b16..a19a98472b 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY visit__referrer_id @@ -50,7 +50,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -61,7 +61,7 @@ FROM ( , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql index 8717c5c52e..5b39c3a0b5 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -197,36 +197,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -319,34 +319,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC(buys_source_src_10002.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_10002.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS buy__ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 802fabd203..d6c6f149cc 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -60,7 +60,7 @@ FROM ( , session_id AS session , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -72,7 +72,7 @@ FROM ( , session_id , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql index 5edfe3d0ca..9c335f3958 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC(buys_source_src_10002.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_10002.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS buy__ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql index 324d79624a..e527a79a88 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC(ds, day) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql index e87ee5db13..50bc6e6fef 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -194,36 +194,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC(visits_source_src_10011.ds, day) AS ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC(visits_source_src_10011.ds, day) AS visit__ds__day - , DATE_TRUNC(visits_source_src_10011.ds, isoweek) AS visit__ds__week - , DATE_TRUNC(visits_source_src_10011.ds, month) AS visit__ds__month - , DATE_TRUNC(visits_source_src_10011.ds, quarter) AS visit__ds__quarter - , DATE_TRUNC(visits_source_src_10011.ds, year) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , IF(EXTRACT(dayofweek FROM visits_source_src_10011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_10011.ds) - 1) AS visit__ds__extract_dow - , EXTRACT(dayofyear FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day + , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week + , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month + , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter + , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow + , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -316,34 +316,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC(buys_source_src_10002.ds, day) AS ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC(buys_source_src_10002.ds, day) AS buy__ds__day - , DATE_TRUNC(buys_source_src_10002.ds, isoweek) AS buy__ds__week - , DATE_TRUNC(buys_source_src_10002.ds, month) AS buy__ds__month - , DATE_TRUNC(buys_source_src_10002.ds, quarter) AS buy__ds__quarter - , DATE_TRUNC(buys_source_src_10002.ds, year) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , IF(EXTRACT(dayofweek FROM buys_source_src_10002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_10002.ds) - 1) AS buy__ds__extract_dow - , EXTRACT(dayofyear FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day + , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week + , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month + , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter + , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow + , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql index 71e53a7547..2a140f4690 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -58,7 +58,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -69,7 +69,7 @@ FROM ( , user_id AS user , 1 AS buys , GENERATE_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql index ff1b29ff71..c61789e34d 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql index a10ee73f73..fda19c9ba7 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql index 9e9b6514f8..c7538526cb 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql @@ -66,36 +66,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -184,36 +184,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -306,34 +306,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql index 1985abd11e..931728e510 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY visit__referrer_id @@ -50,7 +50,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -61,7 +61,7 @@ FROM ( , user_id AS user , 1 AS buys , UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql index 3ffeab914b..ebca9b9a90 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -197,36 +197,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -319,34 +319,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 8466250d18..2a50be7d76 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -60,7 +60,7 @@ FROM ( , session_id AS session , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -72,7 +72,7 @@ FROM ( , session_id , 1 AS buys , UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql index d7377f2ed6..157d1418c3 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql index 682ddbe549..9ada7cb337 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql index b8ba79f0f5..f666d7f15d 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -194,36 +194,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -316,34 +316,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql index d1739f0048..a6f6baac27 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -58,7 +58,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -69,7 +69,7 @@ FROM ( , user_id AS user , 1 AS buys , UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql index a77ef96870..540e2a2ff7 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql index bd03e01924..9d6d3dda85 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql index 9d71f58be3..585c478f6e 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql @@ -66,36 +66,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -184,36 +184,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -306,34 +306,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql index 88337dda5c..ec4ac685fa 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY visit__referrer_id @@ -50,7 +50,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -61,7 +61,7 @@ FROM ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql index 1345288d70..348f11a2fd 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -197,36 +197,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -319,34 +319,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 7f7eefa7c5..1c8008764c 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -60,7 +60,7 @@ FROM ( , session_id AS session , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -72,7 +72,7 @@ FROM ( , session_id , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql index fd540f6713..c6bd93429f 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql index 4bf391c447..e93cebcc83 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql index 85317e3611..9076e7b4f8 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -194,36 +194,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -316,34 +316,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql index fcdaf8291f..3326904f31 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -58,7 +58,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -69,7 +69,7 @@ FROM ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql index 0f27a671f6..cbcb901362 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql index fc33356ace..4d352843c1 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql index 76c0c3e868..bb7adec3fe 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql @@ -66,36 +66,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -184,36 +184,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -306,34 +306,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql index 4194e0647c..eef0a1bd3a 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY visit__referrer_id @@ -50,7 +50,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -61,7 +61,7 @@ FROM ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql index 3ef841b6a5..5fb17d874f 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -197,36 +197,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -319,34 +319,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 216c03fc0b..cf04b1b14c 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -60,7 +60,7 @@ FROM ( , session_id AS session , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -72,7 +72,7 @@ FROM ( , session_id , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql index 58479fc718..9c76d22d39 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql index 9a81d2f3b5..cbecf69018 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql index 6258ac7430..1c26ca1d8e 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -194,36 +194,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(isodow FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -316,34 +316,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(isodow FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql index 415b8c2807..9f9740236c 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -58,7 +58,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -69,7 +69,7 @@ FROM ( , user_id AS user , 1 AS buys , GEN_RANDOM_UUID() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql index 1f4c130459..ea94c52f9a 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql index d4933d4b0d..186b31c974 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql index b320074bf3..dd5dda5d57 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql @@ -66,36 +66,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -184,36 +184,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -306,34 +306,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql index bde0a3c000..90b1250d8a 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY visit__referrer_id @@ -50,7 +50,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -61,7 +61,7 @@ FROM ( , user_id AS user , 1 AS buys , CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql index 4a58f466b8..f172695f8d 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -197,36 +197,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -319,34 +319,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 31ad6c7b8c..196158ae82 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -60,7 +60,7 @@ FROM ( , session_id AS session , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -72,7 +72,7 @@ FROM ( , session_id , 1 AS buys , CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql index 24c21b6b00..ed6d1ba541 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql index f12d5b149a..797aac359e 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql index 06d86d011c..b95b5f3ac4 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -194,36 +194,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , CASE WHEN EXTRACT(dow FROM visits_source_src_10011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_10011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_10011.ds) END AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -316,34 +316,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , CASE WHEN EXTRACT(dow FROM buys_source_src_10002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_10002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_10002.ds) END AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql index cde5a0a479..ce5b8ae2a9 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -58,7 +58,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -69,7 +69,7 @@ FROM ( , user_id AS user , 1 AS buys , CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql index 3ae8e6bc03..29fddc3aad 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql index 368fadb873..a49f83324a 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , UUID_STRING() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql index 71ead8112b..162684165c 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql @@ -66,36 +66,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -184,36 +184,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -306,34 +306,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql index f19a4ec696..2504974b1b 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY visit__referrer_id @@ -50,7 +50,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -61,7 +61,7 @@ FROM ( , user_id AS user , 1 AS buys , UUID_STRING() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql index e03275e46f..771fa3ef07 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -197,36 +197,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -319,34 +319,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 6f2d800915..2f27e70af7 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -60,7 +60,7 @@ FROM ( , session_id AS session , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -72,7 +72,7 @@ FROM ( , session_id , 1 AS buys , UUID_STRING() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql index d8e29c5ea5..61f5e44e8d 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql index a83ac27a70..fbabe42a69 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , UUID_STRING() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql index eac603c0aa..fa3e3e894a 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -194,36 +194,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(dayofweekiso FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -316,34 +316,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(dayofweekiso FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql index a13e98a1f1..e90128a078 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -58,7 +58,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -69,7 +69,7 @@ FROM ( , user_id AS user , 1 AS buys , UUID_STRING() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql index 90c651898d..bde01927ff 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql index 265a30e7cd..0e456f0b75 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , uuid() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql index 7c5189ab86..c8f7ec4221 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql @@ -66,36 +66,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -184,36 +184,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -306,34 +306,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql index 6273669457..c2d5f1e7d3 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY visit__referrer_id @@ -50,7 +50,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -61,7 +61,7 @@ FROM ( , user_id AS user , 1 AS buys , uuid() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql index 6e34e7ef0a..430ed15ad4 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -197,36 +197,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -319,34 +319,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql index 5f0022da71..5e9b77c8ca 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -60,7 +60,7 @@ FROM ( , session_id AS session , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -72,7 +72,7 @@ FROM ( , session_id , 1 AS buys , uuid() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql index 73bcdd89bd..995a089d04 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql @@ -62,36 +62,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -173,36 +173,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -295,34 +295,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql index 22bdcac284..682b934bef 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Aggregate Measures SELECT SUM(1) AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_18 CROSS JOIN ( -- Find conversions for user within the range of 7 day @@ -33,7 +33,7 @@ CROSS JOIN ( DATE_TRUNC('day', ds) AS ds__day , user_id AS user , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -44,7 +44,7 @@ CROSS JOIN ( , user_id AS user , 1 AS buys , uuid() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql index 66a9ddb33d..7057a05216 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql @@ -70,36 +70,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_0 ) subq_1 ) subq_2 @@ -194,36 +194,36 @@ FROM ( -- Read Elements From Semantic Model 'visits_source' SELECT 1 AS visits - , visits_source_src_10011.user_id AS visitors - , DATE_TRUNC('day', visits_source_src_10011.ds) AS ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS ds__extract_doy - , visits_source_src_10011.referrer_id - , DATE_TRUNC('day', visits_source_src_10011.ds) AS visit__ds__day - , DATE_TRUNC('week', visits_source_src_10011.ds) AS visit__ds__week - , DATE_TRUNC('month', visits_source_src_10011.ds) AS visit__ds__month - , DATE_TRUNC('quarter', visits_source_src_10011.ds) AS visit__ds__quarter - , DATE_TRUNC('year', visits_source_src_10011.ds) AS visit__ds__year - , EXTRACT(year FROM visits_source_src_10011.ds) AS visit__ds__extract_year - , EXTRACT(quarter FROM visits_source_src_10011.ds) AS visit__ds__extract_quarter - , EXTRACT(month FROM visits_source_src_10011.ds) AS visit__ds__extract_month - , EXTRACT(day FROM visits_source_src_10011.ds) AS visit__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM visits_source_src_10011.ds) AS visit__ds__extract_dow - , EXTRACT(doy FROM visits_source_src_10011.ds) AS visit__ds__extract_doy - , visits_source_src_10011.referrer_id AS visit__referrer_id - , visits_source_src_10011.user_id AS user - , visits_source_src_10011.session_id AS session - , visits_source_src_10011.user_id AS visit__user - , visits_source_src_10011.session_id AS visit__session - FROM ***************************.fct_visits visits_source_src_10011 + , visits_source_src_28011.user_id AS visitors + , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy + , visits_source_src_28011.referrer_id + , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day + , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week + , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month + , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter + , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year + , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year + , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter + , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month + , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow + , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy + , visits_source_src_28011.referrer_id AS visit__referrer_id + , visits_source_src_28011.user_id AS user + , visits_source_src_28011.session_id AS session + , visits_source_src_28011.user_id AS visit__user + , visits_source_src_28011.session_id AS visit__session + FROM ***************************.fct_visits visits_source_src_28011 ) subq_4 ) subq_5 ) subq_6 @@ -316,34 +316,34 @@ FROM ( -- Read Elements From Semantic Model 'buys_source' SELECT 1 AS buys - , buys_source_src_10002.user_id AS buyers - , DATE_TRUNC('day', buys_source_src_10002.ds) AS ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS ds__extract_doy - , DATE_TRUNC('day', buys_source_src_10002.ds) AS buy__ds__day - , DATE_TRUNC('week', buys_source_src_10002.ds) AS buy__ds__week - , DATE_TRUNC('month', buys_source_src_10002.ds) AS buy__ds__month - , DATE_TRUNC('quarter', buys_source_src_10002.ds) AS buy__ds__quarter - , DATE_TRUNC('year', buys_source_src_10002.ds) AS buy__ds__year - , EXTRACT(year FROM buys_source_src_10002.ds) AS buy__ds__extract_year - , EXTRACT(quarter FROM buys_source_src_10002.ds) AS buy__ds__extract_quarter - , EXTRACT(month FROM buys_source_src_10002.ds) AS buy__ds__extract_month - , EXTRACT(day FROM buys_source_src_10002.ds) AS buy__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM buys_source_src_10002.ds) AS buy__ds__extract_dow - , EXTRACT(doy FROM buys_source_src_10002.ds) AS buy__ds__extract_doy - , buys_source_src_10002.user_id AS user - , buys_source_src_10002.session_id - , buys_source_src_10002.user_id AS buy__user - , buys_source_src_10002.session_id AS buy__session_id - FROM ***************************.fct_buys buys_source_src_10002 + , buys_source_src_28002.user_id AS buyers + , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy + , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day + , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week + , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month + , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter + , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year + , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year + , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter + , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month + , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow + , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy + , buys_source_src_28002.user_id AS user + , buys_source_src_28002.session_id + , buys_source_src_28002.user_id AS buy__user + , buys_source_src_28002.session_id AS buy__session_id + FROM ***************************.fct_buys buys_source_src_28002 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql index 499cb01cc3..8eb1daea87 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_17 GROUP BY metric_time__day @@ -58,7 +58,7 @@ FROM ( , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits - FROM ***************************.fct_visits visits_source_src_10011 + FROM ***************************.fct_visits visits_source_src_28011 ) subq_21 INNER JOIN ( -- Read Elements From Semantic Model 'buys_source' @@ -69,7 +69,7 @@ FROM ( , user_id AS user , 1 AS buys , uuid() AS mf_internal_uuid - FROM ***************************.fct_buys buys_source_src_10002 + FROM ***************************.fct_buys buys_source_src_28002 ) subq_24 ON ( diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml index 7a0ec82f33..40cac96747 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml @@ -1,15 +1,15 @@ - + - - + + - + @@ -20,10 +20,10 @@ - + - + @@ -31,363 +31,363 @@ - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -396,39 +396,39 @@ - + - + - - - + + + - + - + - + - + - - + + - + @@ -446,15 +446,15 @@ - + - - + + - + @@ -463,395 +463,395 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -859,200 +859,200 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1060,359 +1060,359 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml index 6d8e0a279e..4ac7e33117 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml @@ -1,17 +1,17 @@ - + - + - + - + @@ -27,10 +27,10 @@ - + - + @@ -44,10 +44,10 @@ - + - + @@ -55,367 +55,367 @@ - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -424,10 +424,10 @@ - + - + @@ -435,48 +435,48 @@ - + - + - + - + - - + + - + - + - + - + - + - - + + - + @@ -499,15 +499,15 @@ - + - - + + - + @@ -517,400 +517,400 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -918,200 +918,200 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1119,359 +1119,359 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml index c5ee6f507b..736288efbe 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml @@ -1,21 +1,21 @@ - - + + - + - + - + @@ -36,10 +36,10 @@ - + - + @@ -58,12 +58,12 @@ - + - + - + @@ -71,374 +71,374 @@ - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -447,12 +447,12 @@ - + - + - + @@ -460,62 +460,62 @@ - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - - + + - + @@ -548,15 +548,15 @@ - + - - + + - + @@ -567,410 +567,410 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -978,200 +978,200 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1179,359 +1179,359 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml index c00576e7ae..43bf25c535 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml @@ -1,18 +1,18 @@ - + - + - + @@ -23,10 +23,10 @@ - + - + @@ -34,363 +34,363 @@ - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -399,39 +399,39 @@ - + - + - - - + + + - + - + - + - + - - + + - + @@ -449,15 +449,15 @@ - + - - + + - + @@ -466,395 +466,395 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -862,200 +862,200 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1063,359 +1063,359 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml index 2b1f793dc5..0256177bd2 100644 --- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml +++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml @@ -1,21 +1,21 @@ - - + + - + - + - + @@ -36,10 +36,10 @@ - + - + @@ -58,12 +58,12 @@ - + - + - + @@ -71,374 +71,374 @@ - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -447,12 +447,12 @@ - + - + - + @@ -460,60 +460,60 @@ - + - + - + - + - + - + - - + + - + - + - + - + - + - + - - + + - + @@ -541,15 +541,15 @@ - + - - + + - + @@ -560,405 +560,405 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -966,200 +966,200 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1167,359 +1167,359 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + 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 46ddf43a75..4e4162cf69 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 @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user -FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user +FROM ***************************.fct_revenue revenue_src_28007 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 64b103e126..becf4eae22 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 @@ -1,53 +1,53 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC(id_verifications_src_10004.ds, day) AS ds__day - , DATE_TRUNC(id_verifications_src_10004.ds, isoweek) AS ds__week - , DATE_TRUNC(id_verifications_src_10004.ds, month) AS ds__month - , DATE_TRUNC(id_verifications_src_10004.ds, quarter) AS ds__quarter - , DATE_TRUNC(id_verifications_src_10004.ds, year) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC(id_verifications_src_10004.ds, day) AS verification__ds__day - , DATE_TRUNC(id_verifications_src_10004.ds, isoweek) AS verification__ds__week - , DATE_TRUNC(id_verifications_src_10004.ds, month) AS verification__ds__month - , DATE_TRUNC(id_verifications_src_10004.ds, quarter) AS verification__ds__quarter - , DATE_TRUNC(id_verifications_src_10004.ds, year) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds) - 1) AS verification__ds__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, day) AS verification__ds_partitioned__day - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, isoweek) AS verification__ds_partitioned__week - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, month) AS verification__ds_partitioned__month - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, quarter) AS verification__ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, year) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) - 1) AS verification__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user -FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC(id_verifications_src_28004.ds, day) AS ds__day + , DATE_TRUNC(id_verifications_src_28004.ds, isoweek) AS ds__week + , DATE_TRUNC(id_verifications_src_28004.ds, month) AS ds__month + , DATE_TRUNC(id_verifications_src_28004.ds, quarter) AS ds__quarter + , DATE_TRUNC(id_verifications_src_28004.ds, year) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC(id_verifications_src_28004.ds, day) AS verification__ds__day + , DATE_TRUNC(id_verifications_src_28004.ds, isoweek) AS verification__ds__week + , DATE_TRUNC(id_verifications_src_28004.ds, month) AS verification__ds__month + , DATE_TRUNC(id_verifications_src_28004.ds, quarter) AS verification__ds__quarter + , DATE_TRUNC(id_verifications_src_28004.ds, year) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds) - 1) AS verification__ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, day) AS verification__ds_partitioned__day + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, isoweek) AS verification__ds_partitioned__week + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, month) AS verification__ds_partitioned__month + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, quarter) AS verification__ds_partitioned__quarter + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, year) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) - 1) AS verification__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_28004 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 7b29d6211b..e9fce66c32 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 @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10009.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC(users_latest_src_10009.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS user__ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user -FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_28009 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql index ccb8ec6b2f..da22c65a68 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user -FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql index 862e48e108..b8aab0fa4f 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql @@ -1,53 +1,53 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user -FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_28004 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql index e7f784069a..b5f9e4bc6c 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user -FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_28009 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql index a79579b4d0..93878ce423 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user -FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql index 932b17398b..b98864646d 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql @@ -1,53 +1,53 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user -FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_28004 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql index 013c4e0878..f0423bde3c 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user -FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_28009 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql index a79579b4d0..93878ce423 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user -FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql index 932b17398b..b98864646d 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql @@ -1,53 +1,53 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user -FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_28004 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql index 013c4e0878..f0423bde3c 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user -FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_28009 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql index 810035547f..ca527146f8 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user -FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql index 5f55d10c39..29b9a9ebb4 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql @@ -1,53 +1,53 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds) END AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds) END AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) END AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user -FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds) END AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds) END AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) END AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_28004 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql index 9eb9f5d335..e6266dac25 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user -FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_28009 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql index e2bf702863..c6919f64f9 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user -FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql index e40305597f..638fa45049 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql @@ -1,53 +1,53 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user -FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_28004 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql index b8df56ea6e..bf82f0867b 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user -FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_28009 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql index 6bc4618ba3..4c1184dda1 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user -FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql index 26ee6990b0..252f677446 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql @@ -1,53 +1,53 @@ -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user -FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_28004 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql index d14cc5b651..32ccb4be82 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,28 +1,28 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user -FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_28009 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql index f8b095a9f4..ab613c63d2 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql index 2324fc7d69..2c3fd2a2e6 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC(created_at, day) AS ds__day , SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql index 36b4de82e8..d85715075b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql index 63f31daf26..5e75a43a4b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC(created_at, month) AS ds__month , SUM(revenue) AS revenue_mtd -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY ds__month diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql index ca19294f53..2cf65b5d0d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql @@ -101,22 +101,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, month) AS monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, quarter) AS monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, year) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, month) AS booking__monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, quarter) AS booking__monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, year) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS monthly_ds__month + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS monthly_ds__quarter + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS booking__monthly_ds__month + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS booking__monthly_ds__quarter + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql index e01ff82d55..cebaf3f59a 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC(ds, month) AS metric_time__month , bookings_monthly - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 WHERE DATE_TRUNC(ds, month) BETWEEN '2019-12-05' AND '2021-01-04' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql index 77253a21f4..556e45ac8a 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql @@ -51,32 +51,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql index 0265c717f7..e26a1bdb3d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -5,4 +5,4 @@ -- Compute Metrics via Expressions SELECT SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql index 505f380d01..5b266bf166 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql index f41ddb090a..facf505f90 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC(created_at, month) AS ds__month , SUM(revenue) AS revenue_all_time -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY ds__month diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index 5d7b39d1bd..9f6add1096 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -146,32 +146,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index e77fc814db..588064f322 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC(created_at, month) AS metric_time__month , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC(created_at, day) BETWEEN '2000-01-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql index b69c6726cf..fc1a7fcd07 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -99,32 +99,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index 98a20cd5d9..1f114b5424 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -4,15 +4,15 @@ -- Compute Metrics via Expressions SELECT subq_10.ds AS revenue_instance__ds__day - , SUM(revenue_src_10007.revenue) AS trailing_2_months_revenue + , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue FROM ***************************.mf_time_spine subq_10 INNER JOIN - ***************************.fct_revenue revenue_src_10007 + ***************************.fct_revenue revenue_src_28007 ON ( - DATE_TRUNC(revenue_src_10007.created_at, day) <= subq_10.ds + DATE_TRUNC(revenue_src_28007.created_at, day) <= subq_10.ds ) AND ( - DATE_TRUNC(revenue_src_10007.created_at, day) > DATE_SUB(CAST(subq_10.ds AS DATETIME), INTERVAL 2 month) + DATE_TRUNC(revenue_src_28007.created_at, day) > DATE_SUB(CAST(subq_10.ds AS DATETIME), INTERVAL 2 month) ) GROUP BY revenue_instance__ds__day diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index b5ebb55008..8c3004f444 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -230,93 +230,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index 314d5efc6e..48c38d8b33 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -9,15 +9,15 @@ FROM ( -- Pass Only Elements: ['bookers', 'metric_time__day'] SELECT subq_11.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_11 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC(bookings_source_src_10001.ds, day) <= subq_11.ds + DATE_TRUNC(bookings_source_src_28001.ds, day) <= subq_11.ds ) AND ( - DATE_TRUNC(bookings_source_src_10001.ds, day) > DATE_SUB(CAST(subq_11.ds AS DATETIME), INTERVAL 2 day) + DATE_TRUNC(bookings_source_src_28001.ds, day) > DATE_SUB(CAST(subq_11.ds AS DATETIME), INTERVAL 2 day) ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql index 6a6e8ed83c..a59b1c6bd7 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql @@ -144,32 +144,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC(revenue_src_10007.created_at, day) AS ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC(revenue_src_10007.created_at, day) AS revenue_instance__ds__day - , DATE_TRUNC(revenue_src_10007.created_at, isoweek) AS revenue_instance__ds__week - , DATE_TRUNC(revenue_src_10007.created_at, month) AS revenue_instance__ds__month - , DATE_TRUNC(revenue_src_10007.created_at, quarter) AS revenue_instance__ds__quarter - , DATE_TRUNC(revenue_src_10007.created_at, year) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , IF(EXTRACT(dayofweek FROM revenue_src_10007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_10007.created_at) - 1) AS revenue_instance__ds__extract_dow - , EXTRACT(dayofyear FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day + , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week + , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month + , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter + , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index 90f636677b..0d30972ced 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -20,7 +20,7 @@ INNER JOIN ( SELECT DATE_TRUNC(created_at, day) AS metric_time__day , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC(created_at, day) BETWEEN '2019-11-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql index 71994d4d74..e96f97bd79 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql index 8c24543160..749250c230 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('day', created_at) AS ds__day , SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('day', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql index 03c5bf4f62..507f2d3739 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql index a8ab8e5ae9..6a6dbce8b9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_mtd -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql index e42f8a0b2b..5bc9116fc1 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql @@ -101,22 +101,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql index 213d9532f5..4611f8316c 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , bookings_monthly - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql index 91a46f16a4..56e72d2eb4 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql @@ -51,32 +51,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql index 0265c717f7..e26a1bdb3d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -5,4 +5,4 @@ -- Compute Metrics via Expressions SELECT SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql index b8b0c1665a..3b1f31cc45 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql index 301a2bdbb5..a7ca78d4e5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_all_time -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index c6f499ac13..3b1941bbb6 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -146,32 +146,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index 2dbec4daab..a4e5bf994b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', created_at) AS metric_time__month , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql index e1b72a7b0a..de0af3a855 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -99,32 +99,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index c5410fe2df..501e54f5dd 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -4,15 +4,15 @@ -- Compute Metrics via Expressions SELECT subq_10.ds AS revenue_instance__ds__day - , SUM(revenue_src_10007.revenue) AS trailing_2_months_revenue + , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue FROM ***************************.mf_time_spine subq_10 INNER JOIN - ***************************.fct_revenue revenue_src_10007 + ***************************.fct_revenue revenue_src_28007 ON ( - DATE_TRUNC('day', revenue_src_10007.created_at) <= subq_10.ds + DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds ) AND ( - DATE_TRUNC('day', revenue_src_10007.created_at) > DATEADD(month, -2, subq_10.ds) + DATE_TRUNC('day', revenue_src_28007.created_at) > DATEADD(month, -2, subq_10.ds) ) GROUP BY subq_10.ds diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index d1d82334c4..49fd732c02 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -230,93 +230,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index f13fef0c6d..aa43d7d7d6 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -9,15 +9,15 @@ FROM ( -- Pass Only Elements: ['bookers', 'metric_time__day'] SELECT subq_11.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_11 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_11.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_11.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_11.ds) ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql index 91975bf332..f3b2cee287 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql @@ -144,32 +144,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index 221b874d52..06ea3f5a91 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -20,7 +20,7 @@ INNER JOIN ( SELECT DATE_TRUNC('day', created_at) AS metric_time__day , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql index 437c78467a..a19c35420a 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql index 8c24543160..749250c230 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('day', created_at) AS ds__day , SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('day', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql index 83883ec645..af8623a007 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql index a8ab8e5ae9..6a6dbce8b9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_mtd -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql index 52349f4577..238774265f 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql @@ -101,22 +101,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql index 73a16ae4f0..df00087c33 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , bookings_monthly - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql index 0b22eb1685..740a8baf27 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql @@ -51,32 +51,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql index 0265c717f7..e26a1bdb3d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -5,4 +5,4 @@ -- Compute Metrics via Expressions SELECT SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql index 3d8b3508c7..c134310b8b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql index 301a2bdbb5..a7ca78d4e5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_all_time -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index f5bba0a49c..61b9bcc9ac 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -146,32 +146,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index 2dbec4daab..a4e5bf994b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', created_at) AS metric_time__month , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql index 2d7d48e429..68477c9e75 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -99,32 +99,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index 80e5ab0f65..2cfdd396a1 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -4,15 +4,15 @@ -- Compute Metrics via Expressions SELECT subq_10.ds AS revenue_instance__ds__day - , SUM(revenue_src_10007.revenue) AS trailing_2_months_revenue + , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue FROM ***************************.mf_time_spine subq_10 INNER JOIN - ***************************.fct_revenue revenue_src_10007 + ***************************.fct_revenue revenue_src_28007 ON ( - DATE_TRUNC('day', revenue_src_10007.created_at) <= subq_10.ds + DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds ) AND ( - DATE_TRUNC('day', revenue_src_10007.created_at) > subq_10.ds - INTERVAL 2 month + DATE_TRUNC('day', revenue_src_28007.created_at) > subq_10.ds - INTERVAL 2 month ) GROUP BY subq_10.ds diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index 9728af4045..632c06ae57 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -230,93 +230,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index 4adfb3f076..3f6c0bd9d5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -9,15 +9,15 @@ FROM ( -- Pass Only Elements: ['bookers', 'metric_time__day'] SELECT subq_11.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_11 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_11.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_11.ds - INTERVAL 2 day + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_11.ds - INTERVAL 2 day ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql index 4faccf1d37..34b9e71355 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql @@ -144,32 +144,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index ddcc18a49f..1063445e46 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -20,7 +20,7 @@ INNER JOIN ( SELECT DATE_TRUNC('day', created_at) AS metric_time__day , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql index 437c78467a..a19c35420a 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql index 8c24543160..749250c230 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('day', created_at) AS ds__day , SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('day', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql index 83883ec645..af8623a007 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql index a8ab8e5ae9..6a6dbce8b9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_mtd -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql index 7aed70d1a0..8c30047781 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql @@ -101,22 +101,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql index db96d10539..96c1cc7f0b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , bookings_monthly - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql index 0b22eb1685..740a8baf27 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql @@ -51,32 +51,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql index 0265c717f7..e26a1bdb3d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -5,4 +5,4 @@ -- Compute Metrics via Expressions SELECT SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql index 3d8b3508c7..c134310b8b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql index 301a2bdbb5..a7ca78d4e5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_all_time -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index f5bba0a49c..61b9bcc9ac 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -146,32 +146,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index 2dbec4daab..a4e5bf994b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', created_at) AS metric_time__month , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql index 89fdbed788..cbf535c48f 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -99,32 +99,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index e6e5f99fd8..6a552ea045 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -4,15 +4,15 @@ -- Compute Metrics via Expressions SELECT subq_10.ds AS revenue_instance__ds__day - , SUM(revenue_src_10007.revenue) AS trailing_2_months_revenue + , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue FROM ***************************.mf_time_spine subq_10 INNER JOIN - ***************************.fct_revenue revenue_src_10007 + ***************************.fct_revenue revenue_src_28007 ON ( - DATE_TRUNC('day', revenue_src_10007.created_at) <= subq_10.ds + DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds ) AND ( - DATE_TRUNC('day', revenue_src_10007.created_at) > subq_10.ds - MAKE_INTERVAL(months => 2) + DATE_TRUNC('day', revenue_src_28007.created_at) > subq_10.ds - MAKE_INTERVAL(months => 2) ) GROUP BY subq_10.ds diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index 3a654a68bd..d7619f64dc 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -230,93 +230,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index 1071da1e24..e5c6c927b9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -9,15 +9,15 @@ FROM ( -- Pass Only Elements: ['bookers', 'metric_time__day'] SELECT subq_11.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_11 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_11.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_11.ds - MAKE_INTERVAL(days => 2) + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_11.ds - MAKE_INTERVAL(days => 2) ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql index 386f873b9b..034096cfd6 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql @@ -144,32 +144,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(isodow FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index 5914ad44a8..0e6a83d34d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -20,7 +20,7 @@ INNER JOIN ( SELECT DATE_TRUNC('day', created_at) AS metric_time__day , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql index 69a0bef50b..628e764a09 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql index 8c24543160..749250c230 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('day', created_at) AS ds__day , SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('day', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql index fc58a10c21..5449f0fd88 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql index a8ab8e5ae9..6a6dbce8b9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_mtd -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql index e42f8a0b2b..5bc9116fc1 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql @@ -101,22 +101,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql index 213d9532f5..4611f8316c 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , bookings_monthly - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql index d6498d6231..adbc914a7a 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql @@ -51,32 +51,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql index 0265c717f7..e26a1bdb3d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -5,4 +5,4 @@ -- Compute Metrics via Expressions SELECT SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql index b39bbee46e..af069affcc 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql index 301a2bdbb5..a7ca78d4e5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_all_time -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index ab08173827..e9b856ce1a 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -146,32 +146,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index 2dbec4daab..a4e5bf994b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', created_at) AS metric_time__month , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql index 6050ec30ad..6063a555c2 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -99,32 +99,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index c5410fe2df..501e54f5dd 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -4,15 +4,15 @@ -- Compute Metrics via Expressions SELECT subq_10.ds AS revenue_instance__ds__day - , SUM(revenue_src_10007.revenue) AS trailing_2_months_revenue + , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue FROM ***************************.mf_time_spine subq_10 INNER JOIN - ***************************.fct_revenue revenue_src_10007 + ***************************.fct_revenue revenue_src_28007 ON ( - DATE_TRUNC('day', revenue_src_10007.created_at) <= subq_10.ds + DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds ) AND ( - DATE_TRUNC('day', revenue_src_10007.created_at) > DATEADD(month, -2, subq_10.ds) + DATE_TRUNC('day', revenue_src_28007.created_at) > DATEADD(month, -2, subq_10.ds) ) GROUP BY subq_10.ds diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index 43df7ea5cb..59ea896bbc 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -230,93 +230,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index f13fef0c6d..aa43d7d7d6 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -9,15 +9,15 @@ FROM ( -- Pass Only Elements: ['bookers', 'metric_time__day'] SELECT subq_11.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_11 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_11.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_11.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_11.ds) ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql index fc6fe5b93b..0b2cf487c5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql @@ -144,32 +144,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , CASE WHEN EXTRACT(dow FROM revenue_src_10007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_10007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_10007.created_at) END AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index 221b874d52..06ea3f5a91 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -20,7 +20,7 @@ INNER JOIN ( SELECT DATE_TRUNC('day', created_at) AS metric_time__day , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql index fd869b7516..34a09f54e7 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql index 8c24543160..749250c230 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('day', created_at) AS ds__day , SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('day', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql index f317c077d3..55b47814b1 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql index a8ab8e5ae9..6a6dbce8b9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_mtd -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql index e42f8a0b2b..5bc9116fc1 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql @@ -101,22 +101,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql index 213d9532f5..4611f8316c 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , bookings_monthly - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql index 94353437f0..8bc130fbf5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql @@ -51,32 +51,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql index 0265c717f7..e26a1bdb3d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -5,4 +5,4 @@ -- Compute Metrics via Expressions SELECT SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql index 8d9ad3e398..dfc1d734e7 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql index 301a2bdbb5..a7ca78d4e5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_all_time -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index 81e94e0bc7..5e5336aedd 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -146,32 +146,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index 2dbec4daab..a4e5bf994b 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', created_at) AS metric_time__month , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql index 476ef9e8fd..22100cdf6e 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -99,32 +99,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index c5410fe2df..501e54f5dd 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -4,15 +4,15 @@ -- Compute Metrics via Expressions SELECT subq_10.ds AS revenue_instance__ds__day - , SUM(revenue_src_10007.revenue) AS trailing_2_months_revenue + , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue FROM ***************************.mf_time_spine subq_10 INNER JOIN - ***************************.fct_revenue revenue_src_10007 + ***************************.fct_revenue revenue_src_28007 ON ( - DATE_TRUNC('day', revenue_src_10007.created_at) <= subq_10.ds + DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds ) AND ( - DATE_TRUNC('day', revenue_src_10007.created_at) > DATEADD(month, -2, subq_10.ds) + DATE_TRUNC('day', revenue_src_28007.created_at) > DATEADD(month, -2, subq_10.ds) ) GROUP BY subq_10.ds diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index 1f71fc2064..c888543562 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -230,93 +230,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index f13fef0c6d..aa43d7d7d6 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -9,15 +9,15 @@ FROM ( -- Pass Only Elements: ['bookers', 'metric_time__day'] SELECT subq_11.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_11 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_11.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_11.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_11.ds) ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql index d65dd4a5ae..0720bd2b47 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql @@ -144,32 +144,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(dayofweekiso FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index 221b874d52..06ea3f5a91 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -20,7 +20,7 @@ INNER JOIN ( SELECT DATE_TRUNC('day', created_at) AS metric_time__day , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql index 2fdc6828b7..8b87e57774 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql index 8c24543160..749250c230 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('day', created_at) AS ds__day , SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('day', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql index 5af89ec9fa..c3cdc082eb 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql index a8ab8e5ae9..6a6dbce8b9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_mtd -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql index ab2bd6d3d7..8423ed8494 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql @@ -101,22 +101,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 WHERE subq_1.metric_time__month BETWEEN timestamp '2019-12-05' AND timestamp '2021-01-04' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql index 546e55075c..edd17f3f71 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , bookings_monthly - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 WHERE DATE_TRUNC('month', ds) BETWEEN timestamp '2019-12-05' AND timestamp '2021-01-04' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql index 4587c1945e..e38d3d81a3 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql @@ -51,32 +51,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql index 0265c717f7..e26a1bdb3d 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -5,4 +5,4 @@ -- Compute Metrics via Expressions SELECT SUM(revenue) AS trailing_2_months_revenue -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql index db13fa086e..f6c99d18f9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql @@ -54,32 +54,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql index 301a2bdbb5..a7ca78d4e5 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql @@ -6,6 +6,6 @@ SELECT DATE_TRUNC('month', created_at) AS ds__month , SUM(revenue) AS revenue_all_time -FROM ***************************.fct_revenue revenue_src_10007 +FROM ***************************.fct_revenue revenue_src_28007 GROUP BY DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index 6bdd29cc8e..6e4cc27833 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -146,32 +146,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN timestamp '2000-01-01' AND timestamp '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql index 0a617d3a06..681918b712 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -22,7 +22,7 @@ INNER JOIN ( SELECT DATE_TRUNC('month', created_at) AS metric_time__month , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN timestamp '2000-01-01' AND timestamp '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql index 4e0e736a66..44ed3501a2 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql @@ -99,32 +99,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql index 17a2d9722f..3a1a9a5fd9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql @@ -4,15 +4,15 @@ -- Compute Metrics via Expressions SELECT subq_10.ds AS revenue_instance__ds__day - , SUM(revenue_src_10007.revenue) AS trailing_2_months_revenue + , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue FROM ***************************.mf_time_spine subq_10 INNER JOIN - ***************************.fct_revenue revenue_src_10007 + ***************************.fct_revenue revenue_src_28007 ON ( - DATE_TRUNC('day', revenue_src_10007.created_at) <= subq_10.ds + DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds ) AND ( - DATE_TRUNC('day', revenue_src_10007.created_at) > DATE_ADD('month', -2, subq_10.ds) + DATE_TRUNC('day', revenue_src_28007.created_at) > DATE_ADD('month', -2, subq_10.ds) ) GROUP BY subq_10.ds diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql index 39aadb900e..eb8304ee50 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql @@ -230,93 +230,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql index e8098af285..a58cde372e 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql @@ -9,15 +9,15 @@ FROM ( -- Pass Only Elements: ['bookers', 'metric_time__day'] SELECT subq_11.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_11 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_11.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATE_ADD('day', -2, subq_11.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATE_ADD('day', -2, subq_11.ds) ) ) subq_13 WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql index 718bc5635f..9ee18fafc9 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql @@ -144,32 +144,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'revenue' SELECT - revenue_src_10007.revenue AS txn_revenue - , DATE_TRUNC('day', revenue_src_10007.created_at) AS ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS ds__extract_doy - , DATE_TRUNC('day', revenue_src_10007.created_at) AS revenue_instance__ds__day - , DATE_TRUNC('week', revenue_src_10007.created_at) AS revenue_instance__ds__week - , DATE_TRUNC('month', revenue_src_10007.created_at) AS revenue_instance__ds__month - , DATE_TRUNC('quarter', revenue_src_10007.created_at) AS revenue_instance__ds__quarter - , DATE_TRUNC('year', revenue_src_10007.created_at) AS revenue_instance__ds__year - , EXTRACT(year FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_year - , EXTRACT(quarter FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_quarter - , EXTRACT(month FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_month - , EXTRACT(day FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_dow - , EXTRACT(doy FROM revenue_src_10007.created_at) AS revenue_instance__ds__extract_doy - , revenue_src_10007.user_id AS user - , revenue_src_10007.user_id AS revenue_instance__user - FROM ***************************.fct_revenue revenue_src_10007 + revenue_src_28007.revenue AS txn_revenue + , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy + , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day + , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week + , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month + , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter + , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year + , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year + , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter + , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month + , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow + , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy + , revenue_src_28007.user_id AS user + , revenue_src_28007.user_id AS revenue_instance__user + FROM ***************************.fct_revenue revenue_src_28007 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN timestamp '2019-11-01' AND timestamp '2020-01-01' diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql index e932378335..07971fda92 100644 --- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -20,7 +20,7 @@ INNER JOIN ( SELECT DATE_TRUNC('day', created_at) AS metric_time__day , revenue AS txn_revenue - FROM ***************************.fct_revenue revenue_src_10007 + FROM ***************************.fct_revenue revenue_src_28007 WHERE DATE_TRUNC('day', created_at) BETWEEN timestamp '2019-11-01' AND timestamp '2020-01-01' ) subq_11 ON diff --git a/metricflow/test/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml b/metricflow/test/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml index 0346536aa4..2abba64061 100644 --- a/metricflow/test/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml +++ b/metricflow/test/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml @@ -36,11 +36,11 @@ - + - + @@ -53,7 +53,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml index f2c991d978..28a7bc30b8 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml @@ -42,11 +42,11 @@ - + - + @@ -59,11 +59,11 @@ - + - + @@ -110,11 +110,11 @@ - + - + @@ -127,11 +127,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml index 1faa238827..58a7d072ec 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml @@ -20,11 +20,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml index 1086777756..7f4d535ae8 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml @@ -16,11 +16,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml index a5a7ddd824..6423d2cb41 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml @@ -20,11 +20,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml index f5010f94fc..b31c228c02 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml @@ -24,11 +24,11 @@ - + - + @@ -61,11 +61,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml index 0250d138a8..5ffb09c5a4 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml @@ -36,11 +36,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml index ccb7d2e581..2d756cd9b1 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml @@ -36,11 +36,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml index 807d71e838..7e4a651899 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml @@ -39,11 +39,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml index 2bba2c5379..f26eac4fbc 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml @@ -21,7 +21,7 @@ - + @@ -31,11 +31,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml index d543f3193c..57d0191c0f 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml @@ -45,7 +45,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml index eba489f5e6..1d07872946 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml @@ -59,7 +59,7 @@ - + @@ -70,7 +70,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml index 93ddbbf26d..1f8df30b29 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml @@ -16,11 +16,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml index 92a642db2b..d02ffc9330 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml @@ -34,11 +34,11 @@ - + - + @@ -86,11 +86,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml index 3526b6501f..7f45d37287 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml @@ -27,11 +27,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml index 3937ef1041..b56c6c5bd1 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml @@ -22,11 +22,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml index 224ed916ca..77bd3d6c85 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml @@ -47,11 +47,11 @@ - + - + @@ -64,11 +64,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml index 297b852fdc..627470cba1 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml @@ -21,11 +21,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml index a4f1b5745c..f82092841a 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml @@ -98,12 +98,12 @@ - + - + @@ -116,12 +116,12 @@ - + - + @@ -220,12 +220,12 @@ - + - + @@ -238,12 +238,12 @@ - + - + @@ -269,11 +269,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml index 1bbaacec9a..b013ae01fe 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml @@ -80,11 +80,11 @@ - + - + @@ -108,11 +108,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml index bd48d86c6a..45f54625b5 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml @@ -9,11 +9,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml index 0946d4ee4c..1bf29b07c1 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml @@ -9,11 +9,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml index 81313ffe9c..719efef168 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml @@ -27,7 +27,7 @@ - + @@ -38,11 +38,11 @@ - + - + @@ -55,7 +55,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml index d60278c951..55a9c65a28 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml @@ -16,7 +16,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml index c13eedb7b5..dd83ff4539 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml @@ -17,7 +17,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml index 6649e8d4c5..559e1ccf2d 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml @@ -17,7 +17,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml index 039ae2d354..3b81119ee1 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml @@ -47,11 +47,11 @@ - + - + @@ -64,11 +64,11 @@ - + - + @@ -115,11 +115,11 @@ - + - + @@ -132,11 +132,11 @@ - + - + diff --git a/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 8d96f6da07..90d1867079 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 @@ -52,11 +52,11 @@ - + - + @@ -97,7 +97,7 @@ - + @@ -266,7 +266,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml index a58a034cb3..9bc0dfc37d 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml @@ -25,11 +25,11 @@ - + - + @@ -57,11 +57,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml index 2037814c35..1db7a57b08 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml @@ -53,11 +53,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml index aab20d8339..e3725a1dfb 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml @@ -27,11 +27,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml index acfaab17a3..d2f8762d9f 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml @@ -21,11 +21,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml index acfaab17a3..d2f8762d9f 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml @@ -21,11 +21,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml index d580d673cc..51d20709af 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml @@ -47,11 +47,11 @@ - + - + @@ -64,11 +64,11 @@ - + - + @@ -115,11 +115,11 @@ - + - + @@ -132,11 +132,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml index b7f5835d7a..d66d539c58 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml @@ -99,11 +99,11 @@ - + - + @@ -116,11 +116,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml index c3827a386e..7791601ec8 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml @@ -66,11 +66,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml index ec735d878b..52280d4eb0 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml @@ -77,11 +77,11 @@ - + - + @@ -94,11 +94,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml index b7cbb83613..40832a68bb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml index 1bc90d6cd0..6e06248f38 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml @@ -9,7 +9,7 @@ - + @@ -19,12 +19,12 @@ - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml index 78e50c6265..758ee8ee45 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml @@ -9,31 +9,31 @@ - - + + - - - - + + + + - + - + - - + + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml index 8c022814dd..9d39c9adee 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml index 96cca166b8..35d3e1ed33 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml index 0b2cf23d71..cf1f368a88 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml @@ -9,7 +9,7 @@ - + @@ -19,14 +19,14 @@ - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml index 49c9baca89..f77cd373c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml @@ -9,31 +9,31 @@ - - + + - - - - + + + + - + - + - - + + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml index 5f765af61b..a41f3173fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml index 96cca166b8..35d3e1ed33 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml index 0b2cf23d71..cf1f368a88 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml @@ -9,7 +9,7 @@ - + @@ -19,14 +19,14 @@ - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml index 49c9baca89..f77cd373c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml @@ -9,31 +9,31 @@ - - + + - - - - + + + + - + - + - - + + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml index 5f765af61b..a41f3173fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml index 96cca166b8..35d3e1ed33 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml index 0b2cf23d71..cf1f368a88 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml @@ -9,7 +9,7 @@ - + @@ -19,14 +19,14 @@ - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml index 49c9baca89..f77cd373c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml @@ -9,31 +9,31 @@ - - + + - - - - + + + + - + - + - - + + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml index 5f765af61b..a41f3173fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml index 96cca166b8..35d3e1ed33 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml index 0b2cf23d71..cf1f368a88 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml @@ -9,7 +9,7 @@ - + @@ -19,14 +19,14 @@ - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml index 49c9baca89..f77cd373c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml @@ -9,31 +9,31 @@ - - + + - - - - + + + + - + - + - - + + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml index 5f765af61b..a41f3173fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml index 96cca166b8..35d3e1ed33 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml index 0b2cf23d71..cf1f368a88 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml @@ -9,7 +9,7 @@ - + @@ -19,14 +19,14 @@ - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml index 49c9baca89..f77cd373c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml @@ -9,31 +9,31 @@ - - + + - - - - + + + + - + - + - - + + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml index 5f765af61b..a41f3173fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml index 96cca166b8..35d3e1ed33 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml index 0b2cf23d71..cf1f368a88 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml @@ -9,7 +9,7 @@ - + @@ -19,14 +19,14 @@ - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml index 49c9baca89..f77cd373c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml @@ -9,31 +9,31 @@ - - + + - - - - + + + + - + - + - - + + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml index 5f765af61b..a41f3173fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_compute_metrics_node_simple_expr__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_compute_metrics_node_simple_expr__plan0.xml index 9c7e3265ce..3e12b66d6e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_compute_metrics_node_simple_expr__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_compute_metrics_node_simple_expr__plan0.xml @@ -26,7 +26,7 @@ - + @@ -38,7 +38,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml index b9681c0ec8..5bd4c39d66 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml @@ -36,7 +36,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml index 57c801eb40..dbf8a4b139 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml @@ -36,7 +36,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml index 07a0993909..f900442865 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml @@ -36,7 +36,7 @@ - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql index 14dff1ad39..395b5b7783 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY @@ -128,93 +128,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 ) subq_4 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql index 09324f90e0..d43506f88a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( SELECT is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY is_instant @@ -33,7 +33,7 @@ FULL OUTER JOIN ( is_instant , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_10 GROUP BY is_instant 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 9dfc876fca..59667d1092 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 @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql index 302f9bd077..69b81c39cb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Compute Metrics via Expressions SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -11,12 +11,12 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY listing , listing__country_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 3c9bb492df..c3bfd5547a 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 @@ -147,93 +147,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -316,62 +316,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -482,55 +482,55 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC(views_source_src_10010.ds, day) AS ds__day - , DATE_TRUNC(views_source_src_10010.ds, isoweek) AS ds__week - , DATE_TRUNC(views_source_src_10010.ds, month) AS ds__month - , DATE_TRUNC(views_source_src_10010.ds, quarter) AS ds__quarter - , DATE_TRUNC(views_source_src_10010.ds, year) AS ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM views_source_src_10010.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_10010.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM views_source_src_10010.ds) AS ds__extract_doy - , DATE_TRUNC(views_source_src_10010.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(views_source_src_10010.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(views_source_src_10010.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(views_source_src_10010.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(views_source_src_10010.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM views_source_src_10010.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_10010.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(views_source_src_10010.ds, day) AS view__ds__day - , DATE_TRUNC(views_source_src_10010.ds, isoweek) AS view__ds__week - , DATE_TRUNC(views_source_src_10010.ds, month) AS view__ds__month - , DATE_TRUNC(views_source_src_10010.ds, quarter) AS view__ds__quarter - , DATE_TRUNC(views_source_src_10010.ds, year) AS view__ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS view__ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS view__ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS view__ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS view__ds__extract_day - , IF(EXTRACT(dayofweek FROM views_source_src_10010.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_10010.ds) - 1) AS view__ds__extract_dow - , EXTRACT(dayofyear FROM views_source_src_10010.ds) AS view__ds__extract_doy - , DATE_TRUNC(views_source_src_10010.ds_partitioned, day) AS view__ds_partitioned__day - , DATE_TRUNC(views_source_src_10010.ds_partitioned, isoweek) AS view__ds_partitioned__week - , DATE_TRUNC(views_source_src_10010.ds_partitioned, month) AS view__ds_partitioned__month - , DATE_TRUNC(views_source_src_10010.ds_partitioned, quarter) AS view__ds_partitioned__quarter - , DATE_TRUNC(views_source_src_10010.ds_partitioned, year) AS view__ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM views_source_src_10010.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_10010.ds_partitioned) - 1) AS view__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_doy - , views_source_src_10010.listing_id AS listing - , views_source_src_10010.user_id AS user - , views_source_src_10010.listing_id AS view__listing - , views_source_src_10010.user_id AS view__user - FROM ***************************.fct_views views_source_src_10010 + , DATE_TRUNC(views_source_src_28010.ds, day) AS ds__day + , DATE_TRUNC(views_source_src_28010.ds, isoweek) AS ds__week + , DATE_TRUNC(views_source_src_28010.ds, month) AS ds__month + , DATE_TRUNC(views_source_src_28010.ds, quarter) AS ds__quarter + , DATE_TRUNC(views_source_src_28010.ds, year) AS ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM views_source_src_28010.ds) AS ds__extract_doy + , DATE_TRUNC(views_source_src_28010.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(views_source_src_28010.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(views_source_src_28010.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(views_source_src_28010.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(views_source_src_28010.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(views_source_src_28010.ds, day) AS view__ds__day + , DATE_TRUNC(views_source_src_28010.ds, isoweek) AS view__ds__week + , DATE_TRUNC(views_source_src_28010.ds, month) AS view__ds__month + , DATE_TRUNC(views_source_src_28010.ds, quarter) AS view__ds__quarter + , DATE_TRUNC(views_source_src_28010.ds, year) AS view__ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day + , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds) - 1) AS view__ds__extract_dow + , EXTRACT(dayofyear FROM views_source_src_28010.ds) AS view__ds__extract_doy + , DATE_TRUNC(views_source_src_28010.ds_partitioned, day) AS view__ds_partitioned__day + , DATE_TRUNC(views_source_src_28010.ds_partitioned, isoweek) AS view__ds_partitioned__week + , DATE_TRUNC(views_source_src_28010.ds_partitioned, month) AS view__ds_partitioned__month + , DATE_TRUNC(views_source_src_28010.ds_partitioned, quarter) AS view__ds_partitioned__quarter + , DATE_TRUNC(views_source_src_28010.ds_partitioned, year) AS view__ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) - 1) AS view__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy + , views_source_src_28010.listing_id AS listing + , views_source_src_28010.user_id AS user + , views_source_src_28010.listing_id AS view__listing + , views_source_src_28010.user_id AS view__user + FROM ***************************.fct_views views_source_src_28010 ) subq_10 ) subq_11 ) subq_12 @@ -613,62 +613,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_13 ) subq_14 ) subq_15 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index f014a69308..4075d1f5ce 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_23.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_23.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -27,12 +27,12 @@ FROM ( DATE_TRUNC(ds, day) AS ds__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_23.listing = listings_latest_src_10005.listing_id + subq_23.listing = listings_latest_src_28005.listing_id GROUP BY ds__day , listing__country_latest @@ -44,7 +44,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_33.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_33.views) AS views FROM ( -- Read Elements From Semantic Model 'views_source' @@ -54,12 +54,12 @@ FROM ( DATE_TRUNC(ds, day) AS ds__day , listing_id AS listing , 1 AS views - FROM ***************************.fct_views views_source_src_10010 + FROM ***************************.fct_views views_source_src_28010 ) subq_33 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_33.listing = listings_latest_src_10005.listing_id + subq_33.listing = listings_latest_src_28005.listing_id GROUP BY ds__day , listing__country_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 5d4fe42bb8..691359df82 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 @@ -28,93 +28,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql index 028913f93f..e61134a4ec 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Aggregate Measures SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings , COUNT(DISTINCT subq_7.bookers) AS bookers FROM ( @@ -18,12 +18,12 @@ FROM ( listing_id AS listing , 1 AS bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY listing , listing__country_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 941b432490..95a8a594e8 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 @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql index f1638ec98c..85d8832dfe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -7,14 +7,14 @@ FROM ( -- Join Standard Outputs -- Aggregate Measures SELECT - bookings_source_src_10001.listing_id AS listing - , listings_latest_src_10005.country AS listing__country_latest - , SUM(bookings_source_src_10001.booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.listing_id AS listing + , listings_latest_src_28005.country AS listing__country_latest + , SUM(bookings_source_src_28001.booking_value) AS booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id GROUP BY listing , listing__country_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 5aca036989..a0e9d75a3b 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 @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql index e18b0a7e99..75eef26f7e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql @@ -6,5 +6,5 @@ SELECT DATE_TRUNC(ds, day) AS ds__day , DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql index cb021e2164..1450c75977 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql @@ -125,62 +125,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -190,32 +190,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10009.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC(users_latest_src_10009.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS user__ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c279c2841f..8cc8a2b867 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,13 +5,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.country AS listing__country_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.country AS listing__country_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql index 7f49650fa0..8fdb02c3a8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10009.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC(users_latest_src_10009.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS user__ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql index 96767d53ab..8be14ae725 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY listing__is_lux_latest , user__home_state_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 776dbd7a4b..5bb3c3d1a9 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 @@ -6,91 +6,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql index d6917ad0da..bfbf5ff951 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql @@ -2,4 +2,4 @@ -- Pass Only Elements: ['bookings',] SELECT 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 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 001c959573..ecc9bba0c8 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 @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql index 951ed72936..6f43403722 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -8,6 +8,6 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 WHERE booking__ds__day = '2020-01-01' 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 db662d3283..2566084583 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 @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 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_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index e611a6ece8..605c639d2c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day , listing 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 7097d6aeb6..c9b4153e21 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 @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index 2914bc7018..2174faa702 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day , listing 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 9fedc4f2db..9bf9f87b20 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 @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index 78c7fa46f0..0dc2b15fa5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day , listing 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 e758c7f8f3..d37595fcab 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 @@ -16,92 +16,92 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql index 3496296fd7..64fc2826b9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql @@ -6,4 +6,4 @@ SELECT , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings , COUNT(DISTINCT guest_id) AS bookers , AVG(booking_value) AS average_booking_value -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 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 ca38463b54..8538ea9e3f 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 @@ -14,93 +14,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -112,62 +112,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON @@ -181,62 +181,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql index 37a97eab95..b9cecc48d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -18,7 +18,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_9 ON subq_7.listing = subq_9.listing @@ -28,7 +28,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_11 ON subq_7.listing = subq_11.listing 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 71869bb1dd..c609e114ee 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 @@ -26,93 +26,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql index 838674548b..28767fcd6f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( DATE_TRUNC(ds, day) AS ds__day , is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 GROUP BY ds__day 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 0484a10ee3..ccb6e95894 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 @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -70,36 +70,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 ) subq_2 ON 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 61aa3fe5a5..daf549a272 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 @@ -61,14 +61,14 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT MIN(DATE_TRUNC(ds, day)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON subq_3.ds__day = subq_5.ds__day__complete 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 e91a084c62..fafd67ef4c 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 @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MAX(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY 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 0dd050436d..21e367d9b5 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 @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT user_id AS user , MAX(DATE_TRUNC(ds, day)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user ) subq_5 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 b4115630bb..678ad17089 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 @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC(accounts_source_src_10000.ds, day) AS account__ds__day - , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week - , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month - , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter - , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , IF(EXTRACT(dayofweek FROM accounts_source_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_10000.ds) - 1) 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATE_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATE_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATE_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATE_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY ds__week 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 1e737a731e..909a088263 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 @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT DATE_TRUNC(ds, isoweek) AS ds__week , MIN(DATE_TRUNC(ds, day)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY ds__week ) subq_5 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 da8b665d10..6d9849d14f 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 @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -110,62 +110,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql index e9f4093abc..e03ffcce64 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_5.listing = listings_latest_src_10005.listing_id + subq_5.listing = listings_latest_src_28005.listing_id 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 2d3dc84dfd..69189e43bb 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 @@ -2,90 +2,90 @@ 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host +FROM ***************************.fct_bookings bookings_source_src_28001 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 d6aa30d9a4..2778fb000b 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 @@ -88,4 +88,4 @@ SELECT , listing_id AS booking__listing , guest_id AS booking__guest , host_id AS booking__host -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql index 9f6157ec43..f350d5ead8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY @@ -128,93 +128,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 ) subq_4 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql index 8608a790ed..a8375510d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( SELECT is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY is_instant @@ -33,7 +33,7 @@ FULL OUTER JOIN ( is_instant , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_10 GROUP BY is_instant diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql index 794be2e056..4c6fec948c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql index 467ac50313..cf47afc6bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Compute Metrics via Expressions SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -11,12 +11,12 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 5975598752..ae05dce9db 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -147,93 +147,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -316,62 +316,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -482,55 +482,55 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC('day', views_source_src_10010.ds) AS ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_10010.ds) AS ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds) AS view__ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS view__ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS view__ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS view__ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS view__ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS view__ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS view__ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS view__ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS view__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_10010.ds) AS view__ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS view__ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_doy - , views_source_src_10010.listing_id AS listing - , views_source_src_10010.user_id AS user - , views_source_src_10010.listing_id AS view__listing - , views_source_src_10010.user_id AS view__user - FROM ***************************.fct_views views_source_src_10010 + , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy + , views_source_src_28010.listing_id AS listing + , views_source_src_28010.user_id AS user + , views_source_src_28010.listing_id AS view__listing + , views_source_src_28010.user_id AS view__user + FROM ***************************.fct_views views_source_src_28010 ) subq_10 ) subq_11 ) subq_12 @@ -613,62 +613,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_13 ) subq_14 ) subq_15 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index 48d946685e..5b65e65d85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_23.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_23.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -27,15 +27,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_23.listing = listings_latest_src_10005.listing_id + subq_23.listing = listings_latest_src_28005.listing_id GROUP BY subq_23.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_30 FULL OUTER JOIN ( -- Join Standard Outputs @@ -44,7 +44,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_33.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_33.views) AS views FROM ( -- Read Elements From Semantic Model 'views_source' @@ -54,15 +54,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS views - FROM ***************************.fct_views views_source_src_10010 + FROM ***************************.fct_views views_source_src_28010 ) subq_33 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_33.listing = listings_latest_src_10005.listing_id + subq_33.listing = listings_latest_src_28005.listing_id GROUP BY subq_33.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_40 ON ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index 06a5aa4eef..c7ad99ba70 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -28,93 +28,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql index f224bc1803..7c57c360fb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Aggregate Measures SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings , COUNT(DISTINCT subq_7.bookers) AS bookers FROM ( @@ -18,13 +18,13 @@ FROM ( listing_id AS listing , 1 AS bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql index a6816c0fb9..e4ff7804c2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql index 5a844f2632..3bda7562bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -7,15 +7,15 @@ FROM ( -- Join Standard Outputs -- Aggregate Measures SELECT - bookings_source_src_10001.listing_id AS listing - , listings_latest_src_10005.country AS listing__country_latest - , SUM(bookings_source_src_10001.booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.listing_id AS listing + , listings_latest_src_28005.country AS listing__country_latest + , SUM(bookings_source_src_28001.booking_value) AS booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id GROUP BY - bookings_source_src_10001.listing_id - , listings_latest_src_10005.country + bookings_source_src_28001.listing_id + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql index cab31fe302..a9d000576c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql index 363e7d2270..db53f26587 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql @@ -6,5 +6,5 @@ SELECT DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql index 2e4e1ffe59..96f3e16f3c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql @@ -125,62 +125,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -190,32 +190,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c279c2841f..8cc8a2b867 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,13 +5,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.country AS listing__country_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.country AS listing__country_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql index 2b037ef415..5fd13a23f2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql index e94ba5af59..5f826772a6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql @@ -6,91 +6,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql index d6917ad0da..bfbf5ff951 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql @@ -2,4 +2,4 @@ -- Pass Only Elements: ['bookings',] SELECT 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql index 86439d5640..08de4a04d0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql index 36db2718a0..755a4d39e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -8,6 +8,6 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 34fb08931b..152b0e013c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index 9c51fb2478..d5d4ba056e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql index 07ddff77c4..9d60cb466a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index e5b4026b4c..cb1797bad8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql index bf66b937cf..784e5f265a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index dacfc4c7f8..695cf9c062 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql index 75e0d7e619..7ed2fad1d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql @@ -16,92 +16,92 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql index 3496296fd7..64fc2826b9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql @@ -6,4 +6,4 @@ SELECT , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings , COUNT(DISTINCT guest_id) AS bookers , AVG(booking_value) AS average_booking_value -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql index d44706923f..570d1f67eb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql @@ -14,93 +14,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -112,62 +112,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON @@ -181,62 +181,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql index 37a97eab95..b9cecc48d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -18,7 +18,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_9 ON subq_7.listing = subq_9.listing @@ -28,7 +28,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_11 ON subq_7.listing = subq_11.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql index 71aa6fca17..73a9be7514 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql @@ -26,93 +26,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql index 730fb71a50..fd8a1ff597 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql index 3b991ddc6f..44b9beb062 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -70,36 +70,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql index e2ab28ba23..898e433670 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql @@ -61,14 +61,14 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON subq_3.ds__day = subq_5.ds__day__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql index 3693e6cb82..2b69c18f94 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MAX(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 241f4d4578..c29e6b7c0e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT user_id AS user , MAX(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user_id ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 7f37b603da..483cb8a7b8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.ds__week diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 2ed5dd83fa..593e991f90 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT DATE_TRUNC('week', ds) AS ds__week , MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY DATE_TRUNC('week', ds) ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql index b82075caa0..67e5f3fe2d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -110,62 +110,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql index e9f4093abc..e03ffcce64 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_5.listing = listings_latest_src_10005.listing_id + subq_5.listing = listings_latest_src_28005.listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql index 6a1050e14b..00c7139994 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql @@ -2,90 +2,90 @@ 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql index 8b442b9b07..32dc9ad747 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql @@ -88,4 +88,4 @@ SELECT , listing_id AS booking__listing , guest_id AS booking__guest , host_id AS booking__host -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql index 50ebaee27b..a8375b02dd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY @@ -128,93 +128,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 ) subq_4 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql index 8608a790ed..a8375510d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( SELECT is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY is_instant @@ -33,7 +33,7 @@ FULL OUTER JOIN ( is_instant , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_10 GROUP BY is_instant diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql index 4aac3a6766..760f45c973 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql index 467ac50313..cf47afc6bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Compute Metrics via Expressions SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -11,12 +11,12 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index a0711e5fc2..0b73a89b54 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -147,93 +147,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -316,62 +316,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -482,55 +482,55 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC('day', views_source_src_10010.ds) AS ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS ds__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds) AS ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds) AS view__ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS view__ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS view__ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS view__ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS view__ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS view__ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS view__ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS view__ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS view__ds__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds) AS view__ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS view__ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_doy - , views_source_src_10010.listing_id AS listing - , views_source_src_10010.user_id AS user - , views_source_src_10010.listing_id AS view__listing - , views_source_src_10010.user_id AS view__user - FROM ***************************.fct_views views_source_src_10010 + , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy + , views_source_src_28010.listing_id AS listing + , views_source_src_28010.user_id AS user + , views_source_src_28010.listing_id AS view__listing + , views_source_src_28010.user_id AS view__user + FROM ***************************.fct_views views_source_src_28010 ) subq_10 ) subq_11 ) subq_12 @@ -613,62 +613,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_13 ) subq_14 ) subq_15 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index 48d946685e..5b65e65d85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_23.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_23.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -27,15 +27,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_23.listing = listings_latest_src_10005.listing_id + subq_23.listing = listings_latest_src_28005.listing_id GROUP BY subq_23.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_30 FULL OUTER JOIN ( -- Join Standard Outputs @@ -44,7 +44,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_33.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_33.views) AS views FROM ( -- Read Elements From Semantic Model 'views_source' @@ -54,15 +54,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS views - FROM ***************************.fct_views views_source_src_10010 + FROM ***************************.fct_views views_source_src_28010 ) subq_33 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_33.listing = listings_latest_src_10005.listing_id + subq_33.listing = listings_latest_src_28005.listing_id GROUP BY subq_33.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_40 ON ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index f4a87f9be5..3dbab396a9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -28,93 +28,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql index f224bc1803..7c57c360fb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Aggregate Measures SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings , COUNT(DISTINCT subq_7.bookers) AS bookers FROM ( @@ -18,13 +18,13 @@ FROM ( listing_id AS listing , 1 AS bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql index b3024f2c02..d2b2fe8dad 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql index 5a844f2632..3bda7562bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -7,15 +7,15 @@ FROM ( -- Join Standard Outputs -- Aggregate Measures SELECT - bookings_source_src_10001.listing_id AS listing - , listings_latest_src_10005.country AS listing__country_latest - , SUM(bookings_source_src_10001.booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.listing_id AS listing + , listings_latest_src_28005.country AS listing__country_latest + , SUM(bookings_source_src_28001.booking_value) AS booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id GROUP BY - bookings_source_src_10001.listing_id - , listings_latest_src_10005.country + bookings_source_src_28001.listing_id + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql index babb4d6e36..3a0b9aba09 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql index 363e7d2270..db53f26587 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql @@ -6,5 +6,5 @@ SELECT DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql index 9b15bf5e26..8d7833c4da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql @@ -125,62 +125,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -190,32 +190,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c279c2841f..8cc8a2b867 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,13 +5,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.country AS listing__country_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.country AS listing__country_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql index 33e3092700..884b765da5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql index 2626f19805..e8e12063d5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql @@ -6,91 +6,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql index d6917ad0da..bfbf5ff951 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql @@ -2,4 +2,4 @@ -- Pass Only Elements: ['bookings',] SELECT 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql index 5870660c81..ae00bb04ec 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql index 36db2718a0..755a4d39e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -8,6 +8,6 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 99105d3cf1..21fc0ca626 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index 9c51fb2478..d5d4ba056e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql index f6705bd5ef..60b8dc17c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index 41fb69183f..9c1b9ee488 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql index a9ea91fa80..8573c54b5e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index dacfc4c7f8..695cf9c062 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql index 92e04f98a2..693664c2e8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql @@ -16,92 +16,92 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql index 3496296fd7..64fc2826b9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql @@ -6,4 +6,4 @@ SELECT , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings , COUNT(DISTINCT guest_id) AS bookers , AVG(booking_value) AS average_booking_value -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql index b9b4e69490..2aa11d8ca7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql @@ -14,93 +14,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -112,62 +112,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON @@ -181,62 +181,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql index 37a97eab95..b9cecc48d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -18,7 +18,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_9 ON subq_7.listing = subq_9.listing @@ -28,7 +28,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_11 ON subq_7.listing = subq_11.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql index 9882bb42cc..05e8717a48 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql @@ -26,93 +26,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql index 730fb71a50..fd8a1ff597 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql index 1cc34ed0f7..7e857e24d3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -70,36 +70,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql index 856e79ec2a..d159a6215c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql @@ -61,14 +61,14 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON subq_3.ds__day = subq_5.ds__day__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql index f3c7431c9b..f6d73bba58 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MAX(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 0c9362b7f9..23e7270ba7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT user_id AS user , MAX(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user_id ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 02c7dfa09a..d15252a07e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.ds__week diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index e01155ac27..2059c7c53a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT DATE_TRUNC('week', ds) AS ds__week , MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY DATE_TRUNC('week', ds) ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql index fba14407c5..6a69a7ef1b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -110,62 +110,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql index e9f4093abc..e03ffcce64 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_5.listing = listings_latest_src_10005.listing_id + subq_5.listing = listings_latest_src_28005.listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql index 6bfcae0c06..5360aa4516 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql @@ -2,90 +2,90 @@ 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql index 9c8bd00c68..e15f76d1de 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql @@ -88,4 +88,4 @@ SELECT , listing_id AS booking__listing , guest_id AS booking__guest , host_id AS booking__host -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql index 50ebaee27b..a8375b02dd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY @@ -128,93 +128,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 ) subq_4 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql index 8608a790ed..a8375510d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( SELECT is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY is_instant @@ -33,7 +33,7 @@ FULL OUTER JOIN ( is_instant , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_10 GROUP BY is_instant diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql index 4aac3a6766..760f45c973 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql index 467ac50313..cf47afc6bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Compute Metrics via Expressions SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -11,12 +11,12 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index c75a129f49..0d00d2347f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -147,93 +147,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -316,62 +316,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -482,55 +482,55 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC('day', views_source_src_10010.ds) AS ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS ds__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds) AS ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds) AS view__ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS view__ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS view__ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS view__ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS view__ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS view__ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS view__ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS view__ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS view__ds__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds) AS view__ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS view__ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_day - , EXTRACT(isodow FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_doy - , views_source_src_10010.listing_id AS listing - , views_source_src_10010.user_id AS user - , views_source_src_10010.listing_id AS view__listing - , views_source_src_10010.user_id AS view__user - FROM ***************************.fct_views views_source_src_10010 + , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy + , views_source_src_28010.listing_id AS listing + , views_source_src_28010.user_id AS user + , views_source_src_28010.listing_id AS view__listing + , views_source_src_28010.user_id AS view__user + FROM ***************************.fct_views views_source_src_28010 ) subq_10 ) subq_11 ) subq_12 @@ -613,62 +613,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_13 ) subq_14 ) subq_15 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index 8cd9934e12..07a0d3efe7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_23.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_23.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -27,15 +27,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_23.listing = listings_latest_src_10005.listing_id + subq_23.listing = listings_latest_src_28005.listing_id GROUP BY subq_23.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_30 FULL OUTER JOIN ( -- Join Standard Outputs @@ -44,7 +44,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_33.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_33.views) AS views FROM ( -- Read Elements From Semantic Model 'views_source' @@ -54,15 +54,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS views - FROM ***************************.fct_views views_source_src_10010 + FROM ***************************.fct_views views_source_src_28010 ) subq_33 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_33.listing = listings_latest_src_10005.listing_id + subq_33.listing = listings_latest_src_28005.listing_id GROUP BY subq_33.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_40 ON ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index de67b7b3bd..7134ac9ae1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -28,93 +28,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql index 324ad2c645..38e9fae7d2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Aggregate Measures SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings , COUNT(DISTINCT subq_7.bookers) AS bookers FROM ( @@ -18,13 +18,13 @@ FROM ( listing_id AS listing , 1 AS bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql index b3024f2c02..d2b2fe8dad 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql index 5a844f2632..3bda7562bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -7,15 +7,15 @@ FROM ( -- Join Standard Outputs -- Aggregate Measures SELECT - bookings_source_src_10001.listing_id AS listing - , listings_latest_src_10005.country AS listing__country_latest - , SUM(bookings_source_src_10001.booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.listing_id AS listing + , listings_latest_src_28005.country AS listing__country_latest + , SUM(bookings_source_src_28001.booking_value) AS booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id GROUP BY - bookings_source_src_10001.listing_id - , listings_latest_src_10005.country + bookings_source_src_28001.listing_id + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql index babb4d6e36..3a0b9aba09 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql index 363e7d2270..db53f26587 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql @@ -6,5 +6,5 @@ SELECT DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql index 9b15bf5e26..8d7833c4da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql @@ -125,62 +125,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -190,32 +190,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c279c2841f..8cc8a2b867 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,13 +5,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.country AS listing__country_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.country AS listing__country_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql index 33e3092700..884b765da5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql index 2626f19805..e8e12063d5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql @@ -6,91 +6,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql index d6917ad0da..bfbf5ff951 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql @@ -2,4 +2,4 @@ -- Pass Only Elements: ['bookings',] SELECT 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql index 5870660c81..ae00bb04ec 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql index 36db2718a0..755a4d39e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -8,6 +8,6 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 99105d3cf1..21fc0ca626 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index 9c51fb2478..d5d4ba056e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql index e055b9a64b..25edad3460 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index fc6556ad4c..e268d266eb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql index a9ea91fa80..8573c54b5e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index dacfc4c7f8..695cf9c062 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql index 92e04f98a2..693664c2e8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql @@ -16,92 +16,92 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql index 3496296fd7..64fc2826b9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql @@ -6,4 +6,4 @@ SELECT , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings , COUNT(DISTINCT guest_id) AS bookers , AVG(booking_value) AS average_booking_value -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql index b9b4e69490..2aa11d8ca7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql @@ -14,93 +14,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -112,62 +112,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON @@ -181,62 +181,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql index 37a97eab95..b9cecc48d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -18,7 +18,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_9 ON subq_7.listing = subq_9.listing @@ -28,7 +28,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_11 ON subq_7.listing = subq_11.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql index 9882bb42cc..05e8717a48 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql @@ -26,93 +26,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql index 730fb71a50..fd8a1ff597 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql index 1cc34ed0f7..7e857e24d3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -70,36 +70,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql index 856e79ec2a..d159a6215c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql @@ -61,14 +61,14 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON subq_3.ds__day = subq_5.ds__day__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql index f3c7431c9b..f6d73bba58 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MAX(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 0c9362b7f9..23e7270ba7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT user_id AS user , MAX(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user_id ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 02c7dfa09a..d15252a07e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(isodow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.ds__week diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index e01155ac27..2059c7c53a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT DATE_TRUNC('week', ds) AS ds__week , MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY DATE_TRUNC('week', ds) ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql index fba14407c5..6a69a7ef1b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -110,62 +110,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql index e9f4093abc..e03ffcce64 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_5.listing = listings_latest_src_10005.listing_id + subq_5.listing = listings_latest_src_28005.listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql index 6bfcae0c06..5360aa4516 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql @@ -2,90 +2,90 @@ 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql index 9c8bd00c68..e15f76d1de 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql @@ -88,4 +88,4 @@ SELECT , listing_id AS booking__listing , guest_id AS booking__guest , host_id AS booking__host -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql index e972fcfc55..b4a2ffc5f2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY @@ -128,93 +128,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 ) subq_4 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql index 8608a790ed..a8375510d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( SELECT is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY is_instant @@ -33,7 +33,7 @@ FULL OUTER JOIN ( is_instant , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_10 GROUP BY is_instant diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql index adee385ae9..fcf32197e7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql index 467ac50313..cf47afc6bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Compute Metrics via Expressions SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -11,12 +11,12 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 33f0d310ed..f7a597faea 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -147,93 +147,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -316,62 +316,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -482,55 +482,55 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC('day', views_source_src_10010.ds) AS ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM views_source_src_10010.ds) = 0 THEN EXTRACT(dow FROM views_source_src_10010.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_10010.ds) END AS ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM views_source_src_10010.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_10010.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_10010.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds) AS view__ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS view__ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS view__ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS view__ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS view__ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS view__ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS view__ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS view__ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS view__ds__extract_day - , CASE WHEN EXTRACT(dow FROM views_source_src_10010.ds) = 0 THEN EXTRACT(dow FROM views_source_src_10010.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_10010.ds) END AS view__ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS view__ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM views_source_src_10010.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_10010.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_10010.ds_partitioned) END AS view__ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_doy - , views_source_src_10010.listing_id AS listing - , views_source_src_10010.user_id AS user - , views_source_src_10010.listing_id AS view__listing - , views_source_src_10010.user_id AS view__user - FROM ***************************.fct_views views_source_src_10010 + , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds) END AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day + , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds) END AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds_partitioned) END AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy + , views_source_src_28010.listing_id AS listing + , views_source_src_28010.user_id AS user + , views_source_src_28010.listing_id AS view__listing + , views_source_src_28010.user_id AS view__user + FROM ***************************.fct_views views_source_src_28010 ) subq_10 ) subq_11 ) subq_12 @@ -613,62 +613,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_13 ) subq_14 ) subq_15 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index 8cd9934e12..07a0d3efe7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_23.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_23.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -27,15 +27,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_23.listing = listings_latest_src_10005.listing_id + subq_23.listing = listings_latest_src_28005.listing_id GROUP BY subq_23.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_30 FULL OUTER JOIN ( -- Join Standard Outputs @@ -44,7 +44,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_33.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_33.views) AS views FROM ( -- Read Elements From Semantic Model 'views_source' @@ -54,15 +54,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS views - FROM ***************************.fct_views views_source_src_10010 + FROM ***************************.fct_views views_source_src_28010 ) subq_33 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_33.listing = listings_latest_src_10005.listing_id + subq_33.listing = listings_latest_src_28005.listing_id GROUP BY subq_33.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_40 ON ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index dd43545e6a..58a8bb791f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -28,93 +28,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql index 324ad2c645..38e9fae7d2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Aggregate Measures SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings , COUNT(DISTINCT subq_7.bookers) AS bookers FROM ( @@ -18,13 +18,13 @@ FROM ( listing_id AS listing , 1 AS bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql index bca8614e4f..d55d97c5b2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql index 5a844f2632..3bda7562bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -7,15 +7,15 @@ FROM ( -- Join Standard Outputs -- Aggregate Measures SELECT - bookings_source_src_10001.listing_id AS listing - , listings_latest_src_10005.country AS listing__country_latest - , SUM(bookings_source_src_10001.booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.listing_id AS listing + , listings_latest_src_28005.country AS listing__country_latest + , SUM(bookings_source_src_28001.booking_value) AS booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id GROUP BY - bookings_source_src_10001.listing_id - , listings_latest_src_10005.country + bookings_source_src_28001.listing_id + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql index b9336df49e..7bbfa4627e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql index 363e7d2270..db53f26587 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql @@ -6,5 +6,5 @@ SELECT DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql index cfc0d607e7..384068ec70 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql @@ -125,62 +125,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -190,32 +190,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c279c2841f..8cc8a2b867 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,13 +5,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.country AS listing__country_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.country AS listing__country_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql index ee5e923bea..5258faf635 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql index d1c2711a34..c6bba35a07 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql @@ -6,91 +6,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql index d6917ad0da..bfbf5ff951 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql @@ -2,4 +2,4 @@ -- Pass Only Elements: ['bookings',] SELECT 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql index 96d888b5a3..c07f8c5bca 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql index 36db2718a0..755a4d39e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -8,6 +8,6 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 26dbdbe08c..ec28e376e6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index 9c51fb2478..d5d4ba056e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql index eaf4157f74..35a548e0a4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index e5b4026b4c..cb1797bad8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql index f10fe60f38..1b79c4cf87 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index dacfc4c7f8..695cf9c062 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql index 2feaf86e0f..d67aff3bb0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql @@ -16,92 +16,92 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql index 3496296fd7..64fc2826b9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql @@ -6,4 +6,4 @@ SELECT , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings , COUNT(DISTINCT guest_id) AS bookers , AVG(booking_value) AS average_booking_value -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql index e27ccfc052..6a96fe1f63 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql @@ -14,93 +14,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -112,62 +112,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON @@ -181,62 +181,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql index 37a97eab95..b9cecc48d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -18,7 +18,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_9 ON subq_7.listing = subq_9.listing @@ -28,7 +28,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_11 ON subq_7.listing = subq_11.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql index b402892747..dd8c53b524 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql @@ -26,93 +26,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql index 730fb71a50..fd8a1ff597 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql index 98d16b08e5..e0da6b368c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -70,36 +70,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql index 40b6dd448a..8790159c85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql @@ -61,14 +61,14 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON subq_3.ds__day = subq_5.ds__day__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql index 2bc092d310..9a90e73c6d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MAX(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index d858edd2e0..406c588c63 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT user_id AS user , MAX(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user_id ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql index fc6cbc94d4..fbc5127dc6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , CASE WHEN EXTRACT(dow FROM accounts_source_src_10000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_10000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_10000.ds) END AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.ds__week diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index c8e10e1dcf..f81ddba6c9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT DATE_TRUNC('week', ds) AS ds__week , MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY DATE_TRUNC('week', ds) ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql index a4c1572d60..5eb1ecbbfd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -110,62 +110,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql index e9f4093abc..e03ffcce64 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_5.listing = listings_latest_src_10005.listing_id + subq_5.listing = listings_latest_src_28005.listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql index f607d306e4..0d0f27eb45 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql @@ -2,90 +2,90 @@ 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql index f1a438382d..a8f0120386 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql @@ -88,4 +88,4 @@ SELECT , listing_id AS booking__listing , guest_id AS booking__guest , host_id AS booking__host -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql index d263e8cdfe..c9b56f342d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY @@ -128,93 +128,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 ) subq_4 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql index 8608a790ed..a8375510d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( SELECT is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY is_instant @@ -33,7 +33,7 @@ FULL OUTER JOIN ( is_instant , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_10 GROUP BY is_instant diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql index 8b25c9e8e5..6f3082341a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql index 467ac50313..cf47afc6bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Compute Metrics via Expressions SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -11,12 +11,12 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 145bf4d745..f1535bf8d2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -147,93 +147,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -316,62 +316,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -482,55 +482,55 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC('day', views_source_src_10010.ds) AS ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM views_source_src_10010.ds) AS ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds) AS view__ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS view__ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS view__ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS view__ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS view__ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS view__ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS view__ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS view__ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS view__ds__extract_day - , EXTRACT(dayofweekiso FROM views_source_src_10010.ds) AS view__ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS view__ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_doy - , views_source_src_10010.listing_id AS listing - , views_source_src_10010.user_id AS user - , views_source_src_10010.listing_id AS view__listing - , views_source_src_10010.user_id AS view__user - FROM ***************************.fct_views views_source_src_10010 + , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM views_source_src_28010.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day + , EXTRACT(dayofweekiso FROM views_source_src_28010.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy + , views_source_src_28010.listing_id AS listing + , views_source_src_28010.user_id AS user + , views_source_src_28010.listing_id AS view__listing + , views_source_src_28010.user_id AS view__user + FROM ***************************.fct_views views_source_src_28010 ) subq_10 ) subq_11 ) subq_12 @@ -613,62 +613,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_13 ) subq_14 ) subq_15 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index 48d946685e..5b65e65d85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_23.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_23.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -27,15 +27,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_23.listing = listings_latest_src_10005.listing_id + subq_23.listing = listings_latest_src_28005.listing_id GROUP BY subq_23.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_30 FULL OUTER JOIN ( -- Join Standard Outputs @@ -44,7 +44,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_33.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_33.views) AS views FROM ( -- Read Elements From Semantic Model 'views_source' @@ -54,15 +54,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS views - FROM ***************************.fct_views views_source_src_10010 + FROM ***************************.fct_views views_source_src_28010 ) subq_33 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_33.listing = listings_latest_src_10005.listing_id + subq_33.listing = listings_latest_src_28005.listing_id GROUP BY subq_33.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_40 ON ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index 770a95cec4..63a16e88aa 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -28,93 +28,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql index f224bc1803..7c57c360fb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Aggregate Measures SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings , COUNT(DISTINCT subq_7.bookers) AS bookers FROM ( @@ -18,13 +18,13 @@ FROM ( listing_id AS listing , 1 AS bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql index cc908af64e..d1ea5963e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql index 5a844f2632..3bda7562bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -7,15 +7,15 @@ FROM ( -- Join Standard Outputs -- Aggregate Measures SELECT - bookings_source_src_10001.listing_id AS listing - , listings_latest_src_10005.country AS listing__country_latest - , SUM(bookings_source_src_10001.booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.listing_id AS listing + , listings_latest_src_28005.country AS listing__country_latest + , SUM(bookings_source_src_28001.booking_value) AS booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id GROUP BY - bookings_source_src_10001.listing_id - , listings_latest_src_10005.country + bookings_source_src_28001.listing_id + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql index 1aedfdc91d..9b413ab923 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql index 363e7d2270..db53f26587 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql @@ -6,5 +6,5 @@ SELECT DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql index b8c4a1fbde..68e27b96e0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql @@ -125,62 +125,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -190,32 +190,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c279c2841f..8cc8a2b867 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,13 +5,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.country AS listing__country_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.country AS listing__country_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql index 62f316a9b1..2d95b7bd1e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql index f6c1410325..3c43a990ff 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql @@ -6,91 +6,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql index d6917ad0da..bfbf5ff951 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql @@ -2,4 +2,4 @@ -- Pass Only Elements: ['bookings',] SELECT 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql index 835a5ed796..b982200696 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql index 36db2718a0..755a4d39e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -8,6 +8,6 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index e03049e5a7..6e3a76c40e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index 9c51fb2478..d5d4ba056e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql index 48579e1e3c..dd5074bc47 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index e5b4026b4c..cb1797bad8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql index 2ac52be258..0b5d978d3f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index dacfc4c7f8..695cf9c062 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql index b44d7c4a3f..3e74cf958d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql @@ -16,92 +16,92 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql index 3496296fd7..64fc2826b9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql @@ -6,4 +6,4 @@ SELECT , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings , COUNT(DISTINCT guest_id) AS bookers , AVG(booking_value) AS average_booking_value -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql index efded38d67..7b8e8ed9ed 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql @@ -14,93 +14,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -112,62 +112,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON @@ -181,62 +181,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql index 37a97eab95..b9cecc48d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -18,7 +18,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_9 ON subq_7.listing = subq_9.listing @@ -28,7 +28,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_11 ON subq_7.listing = subq_11.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql index 82c0f61ef2..645d50b2fc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql @@ -26,93 +26,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql index 730fb71a50..fd8a1ff597 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql index 730e82659f..07052ef0f2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -70,36 +70,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql index a15965a3f5..e2dc17ba69 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql @@ -61,14 +61,14 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON subq_3.ds__day = subq_5.ds__day__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql index 60fe2c6161..f465bab0f9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MAX(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index bc6b912f02..9e9d03bd02 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT user_id AS user , MAX(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user_id ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql index c2b0458b1d..bc47f78312 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(dayofweekiso FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.ds__week diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 6cf051c56d..14d2446f48 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT DATE_TRUNC('week', ds) AS ds__week , MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY DATE_TRUNC('week', ds) ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql index 09f2041b40..53a5b7f6bd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -110,62 +110,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql index e9f4093abc..e03ffcce64 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_5.listing = listings_latest_src_10005.listing_id + subq_5.listing = listings_latest_src_28005.listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql index 5faa3271b8..46563afc1f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql @@ -2,90 +2,90 @@ 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql index a71958b980..f82aa0eaaf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql @@ -88,4 +88,4 @@ SELECT , listing_id AS booking__listing , guest_id AS booking__guest , host_id AS booking__host -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql index 4ceca484e6..a276e77024 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY @@ -128,93 +128,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 ) subq_4 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql index 8608a790ed..a8375510d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql @@ -15,7 +15,7 @@ FROM ( SELECT is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY is_instant @@ -33,7 +33,7 @@ FULL OUTER JOIN ( is_instant , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_10 GROUP BY is_instant diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql index ef4fbb89cc..36c720c533 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql index 467ac50313..cf47afc6bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Compute Metrics via Expressions SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -11,12 +11,12 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 5b314416a0..1b65412a32 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -147,93 +147,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -316,62 +316,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -482,55 +482,55 @@ FROM ( -- Read Elements From Semantic Model 'views_source' SELECT 1 AS views - , DATE_TRUNC('day', views_source_src_10010.ds) AS ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM views_source_src_10010.ds) AS ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds) AS view__ds__day - , DATE_TRUNC('week', views_source_src_10010.ds) AS view__ds__week - , DATE_TRUNC('month', views_source_src_10010.ds) AS view__ds__month - , DATE_TRUNC('quarter', views_source_src_10010.ds) AS view__ds__quarter - , DATE_TRUNC('year', views_source_src_10010.ds) AS view__ds__year - , EXTRACT(year FROM views_source_src_10010.ds) AS view__ds__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds) AS view__ds__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds) AS view__ds__extract_month - , EXTRACT(day FROM views_source_src_10010.ds) AS view__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM views_source_src_10010.ds) AS view__ds__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds) AS view__ds__extract_doy - , DATE_TRUNC('day', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__day - , DATE_TRUNC('week', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__week - , DATE_TRUNC('month', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__month - , DATE_TRUNC('quarter', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__quarter - , DATE_TRUNC('year', views_source_src_10010.ds_partitioned) AS view__ds_partitioned__year - , EXTRACT(year FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_year - , EXTRACT(quarter FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_quarter - , EXTRACT(month FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(day FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_dow - , EXTRACT(doy FROM views_source_src_10010.ds_partitioned) AS view__ds_partitioned__extract_doy - , views_source_src_10010.listing_id AS listing - , views_source_src_10010.user_id AS user - , views_source_src_10010.listing_id AS view__listing - , views_source_src_10010.user_id AS view__user - FROM ***************************.fct_views views_source_src_10010 + , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day + , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week + , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month + , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter + , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year + , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month + , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy + , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day + , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week + , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy + , views_source_src_28010.listing_id AS listing + , views_source_src_28010.user_id AS user + , views_source_src_28010.listing_id AS view__listing + , views_source_src_28010.user_id AS view__user + FROM ***************************.fct_views views_source_src_28010 ) subq_10 ) subq_11 ) subq_12 @@ -613,62 +613,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_13 ) subq_14 ) subq_15 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql index 48d946685e..5b65e65d85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_23.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_23.bookings) AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -27,15 +27,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_23.listing = listings_latest_src_10005.listing_id + subq_23.listing = listings_latest_src_28005.listing_id GROUP BY subq_23.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_30 FULL OUTER JOIN ( -- Join Standard Outputs @@ -44,7 +44,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_33.ds__day AS ds__day - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_33.views) AS views FROM ( -- Read Elements From Semantic Model 'views_source' @@ -54,15 +54,15 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , listing_id AS listing , 1 AS views - FROM ***************************.fct_views views_source_src_10010 + FROM ***************************.fct_views views_source_src_28010 ) subq_33 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_33.listing = listings_latest_src_10005.listing_id + subq_33.listing = listings_latest_src_28005.listing_id GROUP BY subq_33.ds__day - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_40 ON ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index a294bae4d4..812ca8344a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -28,93 +28,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql index f224bc1803..7c57c360fb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Aggregate Measures SELECT subq_7.listing AS listing - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , SUM(subq_7.bookings) AS bookings , COUNT(DISTINCT subq_7.bookers) AS bookers FROM ( @@ -18,13 +18,13 @@ FROM ( listing_id AS listing , 1 AS bookings , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_7.listing = listings_latest_src_10005.listing_id + subq_7.listing = listings_latest_src_28005.listing_id GROUP BY subq_7.listing - , listings_latest_src_10005.country + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql index 63686f677a..2bd5c9d86e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql @@ -25,93 +25,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -123,62 +123,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql index 5a844f2632..3bda7562bf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -7,15 +7,15 @@ FROM ( -- Join Standard Outputs -- Aggregate Measures SELECT - bookings_source_src_10001.listing_id AS listing - , listings_latest_src_10005.country AS listing__country_latest - , SUM(bookings_source_src_10001.booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.listing_id AS listing + , listings_latest_src_28005.country AS listing__country_latest + , SUM(bookings_source_src_28001.booking_value) AS booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id GROUP BY - bookings_source_src_10001.listing_id - , listings_latest_src_10005.country + bookings_source_src_28001.listing_id + , listings_latest_src_28005.country ) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql index e617fffbfe..bba1d890d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql @@ -19,93 +19,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql index 6fc168282f..b8eb96e8e9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql @@ -6,5 +6,5 @@ SELECT DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-02' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql index 227b236fc9..9bf2a562f5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql @@ -125,62 +125,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -190,32 +190,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c279c2841f..8cc8a2b867 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,13 +5,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.country AS listing__country_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.country AS listing__country_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql index 221005d99e..9dea907a17 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql index 4546b4b90e..27231f192b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql @@ -6,91 +6,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql index d6917ad0da..bfbf5ff951 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql @@ -2,4 +2,4 @@ -- Pass Only Elements: ['bookings',] SELECT 1 AS bookings -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql index 4f4e315030..a0f5744171 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql index 36db2718a0..755a4d39e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -8,6 +8,6 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_3 WHERE booking__ds__day = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 26a6b173c5..ec47dfdc83 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql index 91fcd90ad3..55f87d10bc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql index a22a7f3500..079efbd3b0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql index 3a911e1e67..1219f9e494 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql index 2a8d252732..3cd1a50096 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql @@ -134,93 +134,93 @@ INNER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql index 3375d69c39..8ea0c288dc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql @@ -25,7 +25,7 @@ INNER JOIN ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) , listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql index 1d2862b90c..dba9ded776 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql @@ -16,92 +16,92 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql index 3496296fd7..64fc2826b9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql @@ -6,4 +6,4 @@ SELECT , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings , COUNT(DISTINCT guest_id) AS bookers , AVG(booking_value) AS average_booking_value -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql index e08d7a7c47..679926be9f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql @@ -14,93 +14,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -112,62 +112,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON @@ -181,62 +181,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql index 37a97eab95..b9cecc48d8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -18,7 +18,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_9 ON subq_7.listing = subq_9.listing @@ -28,7 +28,7 @@ LEFT OUTER JOIN ( SELECT listing_id AS listing , country AS country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_11 ON subq_7.listing = subq_11.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql index 5075e628c9..f77b20ceac 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql @@ -26,93 +26,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql index 730fb71a50..fd8a1ff597 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql @@ -12,7 +12,7 @@ FROM ( DATE_TRUNC('day', ds) AS ds__day , is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql index e2631c06c4..f9ca1bb92e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -70,36 +70,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql index 3bb832607b..fcf6da5d40 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql @@ -61,14 +61,14 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' -- Filter row on MIN(ds__day) SELECT MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_5 ON subq_3.ds__day = subq_5.ds__day__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql index 1573868cd0..891a5e7634 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MAX(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 0fe5d6b65d..c5d4f50c46 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT user_id AS user , MAX(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY user_id ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 4cd48b4c62..153ba096c5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -32,36 +32,36 @@ SELECT FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_0 INNER JOIN ( -- Filter row on MIN(ds__day) @@ -71,36 +71,36 @@ INNER JOIN ( FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT - accounts_source_src_10000.account_balance - , accounts_source_src_10000.account_balance AS total_account_balance_first_day - , accounts_source_src_10000.account_balance AS current_account_balance_by_user - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year - , 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(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy - , accounts_source_src_10000.account_type - , DATE_TRUNC('day', accounts_source_src_10000.ds) AS account__ds__day - , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week - , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month - , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter - , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year - , 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(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(doy 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 - FROM ***************************.fct_accounts accounts_source_src_10000 + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_1 GROUP BY subq_1.ds__week diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 2b23979547..fe4e69f567 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -61,7 +61,7 @@ FROM ( , account_type AS account__account_type , user_id AS user , user_id AS account__user - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 ) subq_3 INNER JOIN ( -- Read Elements From Semantic Model 'accounts_source' @@ -69,7 +69,7 @@ INNER JOIN ( SELECT DATE_TRUNC('week', ds) AS ds__week , MIN(DATE_TRUNC('day', ds)) AS ds__day__complete - FROM ***************************.fct_accounts accounts_source_src_10000 + FROM ***************************.fct_accounts accounts_source_src_28000 GROUP BY DATE_TRUNC('week', ds) ) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql index deae2c37a5..ffd4bbce0f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql @@ -12,93 +12,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 LEFT OUTER JOIN ( @@ -110,62 +110,62 @@ LEFT OUTER JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_2 ) subq_3 ON diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql index e9f4093abc..e03ffcce64 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( SELECT listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_5.listing = listings_latest_src_10005.listing_id + subq_5.listing = listings_latest_src_28005.listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql index d04bcf5afc..29278dc9f7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql @@ -2,90 +2,90 @@ 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql index 433a78e339..eb73e0c58e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql @@ -88,4 +88,4 @@ SELECT , listing_id AS booking__listing , guest_id AS booking__guest , host_id AS booking__host -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml index 77344a8357..519599da2b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml @@ -55,392 +55,392 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -471,392 +471,392 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml index a3b81f8c0a..b57bd3341e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml @@ -58,434 +58,434 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -496,280 +496,280 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml index 12d55cf773..61f123ca07 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml @@ -1,17 +1,17 @@ - - + + - + - + - + @@ -32,10 +32,10 @@ - + - + @@ -54,25 +54,25 @@ - - + + - + - - + + - + - + - + @@ -80,58 +80,58 @@ - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + @@ -140,970 +140,970 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1111,651 +1111,651 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1767,25 +1767,25 @@ - - + + - + - - + + - + - + - + @@ -1793,58 +1793,58 @@ - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + @@ -1853,585 +1853,585 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -2439,651 +2439,651 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml index 2438f3331e..1a3a7551d4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml @@ -66,434 +66,434 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -504,280 +504,280 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml index 03c7c8f314..9e67e7a2cc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml @@ -63,434 +63,434 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -501,280 +501,280 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml index 29350fc381..6decb3d819 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml @@ -23,392 +23,392 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml index 11e7ff8e34..c27048ce51 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml @@ -1,413 +1,413 @@ - + - - + + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - + + - - - - + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - - - + + + - + - + - + - + - + - + - - + + - + @@ -416,387 +416,387 @@ - + - + - + - + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml index d90feed1e9..26db0cae48 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml @@ -1,209 +1,209 @@ - + - + - - + + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + - + - + - + - + - + - + - - + + - + @@ -212,337 +212,337 @@ - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml index ca48adaf21..bd9ed18639 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml @@ -3,271 +3,271 @@ - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml index 06c10599a5..0120048169 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml @@ -12,335 +12,335 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml index 22ffba3937..a7bb0593ae 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml @@ -542,449 +542,449 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml index 22ffba3937..a7bb0593ae 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml @@ -542,449 +542,449 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml index 22ffba3937..a7bb0593ae 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml @@ -542,449 +542,449 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml index 6522d99506..d8675f5ef6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml @@ -35,335 +35,335 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml index 8c1b46b1b3..5f2f3d21d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml @@ -30,335 +30,335 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - + + - + @@ -368,211 +368,211 @@ - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + @@ -582,211 +582,211 @@ - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml index 43fb832189..a4e916df12 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml @@ -44,434 +44,434 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml index 769d0a01e6..e8e9e091c9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml @@ -55,7 +55,7 @@ - + @@ -67,70 +67,70 @@ - + - + - + - + - - - - - - - - - - - + + + + + + + + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -142,100 +142,100 @@ - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml index a6518e263d..4672ad8a85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml @@ -55,7 +55,7 @@ - + @@ -67,70 +67,70 @@ - + - + - + - + - - - - - - - - - - - + + + + + + + + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -143,101 +143,101 @@ - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml index b7bb39da5b..b084372526 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml @@ -55,7 +55,7 @@ - + @@ -67,70 +67,70 @@ - + - + - + - + - - - - - - - - - - - + + + + + + + + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -143,101 +143,101 @@ - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml index 11b6d20ab0..00a302afef 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml @@ -19,335 +19,335 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - + + - + @@ -361,211 +361,211 @@ - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml index 9a3da3cc83..95ba58e76a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml @@ -1,205 +1,205 @@ - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - + + - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - - + + + + - + diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 895d1706e1..f4d266a946 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -333,93 +333,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index afe668988d..8017ba04bd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -22,15 +22,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_15.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_15 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC(bookings_source_src_10001.ds, day) <= subq_15.ds + DATE_TRUNC(bookings_source_src_28001.ds, day) <= subq_15.ds ) AND ( - DATE_TRUNC(bookings_source_src_10001.ds, day) > DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 2 day) + DATE_TRUNC(bookings_source_src_28001.ds, day) > DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 2 day) ) ) subq_16 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql index a171c5076d..13d7c71960 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -344,93 +344,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql index 31d175bce4..96c7f9893d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 GROUP BY metric_time__day @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index c6a1728d94..0de5b54144 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -71,22 +71,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, month) AS monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, quarter) AS monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, year) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, month) AS booking__monthly_ds__month - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, quarter) AS booking__monthly_ds__quarter - , DATE_TRUNC(bookings_monthly_source_src_10026.ds, year) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS monthly_ds__month + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS monthly_ds__quarter + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) AS booking__monthly_ds__month + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, quarter) AS booking__monthly_ds__quarter + , DATE_TRUNC(bookings_monthly_source_src_16000.ds, year) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index bde7f345c4..5d3bd940a3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_10.metric_time__month AS metric_time__month - , SUM(bookings_monthly_source_src_10026.bookings_monthly) AS bookings_last_month + , SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month FROM ( -- Time Spine SELECT @@ -19,9 +19,9 @@ FROM ( metric_time__month ) subq_10 INNER JOIN - ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - DATE_SUB(CAST(subq_10.metric_time__month AS DATETIME), INTERVAL 1 month) = DATE_TRUNC(bookings_monthly_source_src_10026.ds, month) + DATE_SUB(CAST(subq_10.metric_time__month AS DATETIME), INTERVAL 1 month) = DATE_TRUNC(bookings_monthly_source_src_16000.ds, month) GROUP BY metric_time__month ) subq_15 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql index 4cf4d2ce14..fea9961fc7 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index c955ae3ff4..d37df9cff5 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC(subq_22.ds, month) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index aa4c638ac5..06c13a54dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index 7eb6991273..5deccf14fa 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC(ds, isoweek) AS metric_time__week , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__week @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC(subq_22.ds, month) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql index 67a3afb131..c16f9d3134 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql index d817d15c36..8fa70fcf9d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql index d0bb85e746..0b17b0c775 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index 0014297905..d826bdbd46 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC(ds, quarter) AS metric_time__quarter , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__quarter @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index b553f985a6..9afd2673b1 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -541,93 +541,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index 95bf4295b7..1d68b2b651 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC(subq_20.ds, month) = subq_18.metric_time__day @@ -45,7 +45,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATE_SUB(CAST(subq_28.ds AS DATETIME), INTERVAL 1 month) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index f7f4c978dd..8bd8d05233 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -542,93 +542,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index 72e9bee50c..48eb4e3434 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC(subq_20.ds, month) = subq_18.metric_time__day @@ -46,7 +46,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATE_SUB(CAST(subq_28.ds AS DATETIME), INTERVAL 1 month) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 94fa79fa51..c6c85ac0bc 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -134,93 +134,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -453,93 +453,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 ) subq_7 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index 79d5f4dfa9..7c07e7377c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14' GROUP BY @@ -48,7 +48,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 ON DATE_SUB(CAST(subq_25.ds AS DATETIME), INTERVAL 14 day) = subq_23.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql index 8345d0e970..fa913a0870 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql @@ -327,93 +327,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql index 38d5753e39..e1b2edc391 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -15,15 +15,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_14.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_14 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC(bookings_source_src_10001.ds, day) <= subq_14.ds + DATE_TRUNC(bookings_source_src_28001.ds, day) <= subq_14.ds ) AND ( - DATE_TRUNC(bookings_source_src_10001.ds, day) > DATE_SUB(CAST(subq_14.ds AS DATETIME), INTERVAL 2 day) + DATE_TRUNC(bookings_source_src_28001.ds, day) > DATE_SUB(CAST(subq_14.ds AS DATETIME), INTERVAL 2 day) ) ) subq_15 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 13287947de..6a7e286712 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -444,93 +444,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ) subq_10 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index e4636b72a4..9ac31a60a2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -15,12 +15,12 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS booking__ds__day - , SUM(bookings_source_src_10001.booking_value) AS booking_value + , SUM(bookings_source_src_28001.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON - DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 1 week) = DATE_TRUNC(bookings_source_src_10001.ds, day) + DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 1 week) = DATE_TRUNC(bookings_source_src_28001.ds, day) GROUP BY booking__ds__day ) subq_21 @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY booking__ds__day ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql index bda8ca8a3d..54f41d6072 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -220,93 +220,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index 53a5fe2252..7d08909b4c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATE_SUB(CAST(subq_11.ds AS DATETIME), INTERVAL 5 day) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql index 8906f045b0..5b00e7ea4e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -356,93 +356,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 @@ -577,93 +577,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -794,93 +794,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_17 ) subq_18 ) subq_19 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql index b11fc2ff4a..01e8970931 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_25 GROUP BY metric_time__day @@ -51,7 +51,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_30 GROUP BY metric_time__day @@ -75,7 +75,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_37 GROUP BY metric_time__day @@ -95,7 +95,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_42 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index 8016f6a6cd..679f1017aa 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -252,93 +252,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index 7771a09ad8..c8d2c6d5e3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -38,7 +38,7 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 ON DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 5 day) = subq_15.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index e626d317b5..d57a33a14b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -145,93 +145,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -369,93 +369,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ) subq_10 ) subq_11 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index fee498be74..ffc76505df 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day ) subq_20 @@ -50,7 +50,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day ) subq_29 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql index 1178d12b59..c3ec7a2819 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql @@ -154,93 +154,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -323,62 +323,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -534,93 +534,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -703,62 +703,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -899,93 +899,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql index 9291d22ff3..14649c62dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql @@ -22,14 +22,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - bookings_source_src_10001.is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.is_instant AS booking__is_instant + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_40 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_44 @@ -45,7 +45,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT subq_47.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_47.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -55,12 +55,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_47 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_47.listing = listings_latest_src_10005.listing_id + subq_47.listing = listings_latest_src_28005.listing_id ) subq_52 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_56 @@ -78,7 +78,7 @@ FROM ( SELECT is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_59 WHERE booking__is_instant ) subq_63 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql index 15f03b977f..0e363a5bea 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql index 5e55ef7013..6ccdca5949 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 5 day) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql index beecb4c7a9..6d2d03942f 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql @@ -237,93 +237,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql index 0cbebb4184..6a5e37b13e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -34,7 +34,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 5 day) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql index ea1138bd91..4775f4046c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql @@ -241,93 +241,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql index 1862a49442..a19f6253a1 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_14 ON DATE_SUB(CAST(subq_16.ds AS DATETIME), INTERVAL 5 day) = subq_14.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql index c3a1f7da38..45846b3999 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index 826783a97b..6a4f47cc54 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC(subq_22.ds, month) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql index 80ab005bc8..c855ed38d8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql index 4d9fa6e0d0..7fd58814bc 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql index d3f9045e01..4e204fef06 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index d7f812c85e..4e0b8eddb8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATE_SUB(CAST(subq_10.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 28aa46297f..d975878710 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -333,93 +333,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index c5757a4c54..d998382fb8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -22,15 +22,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_15.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_15 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_15.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_15.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_15.ds) ) ) subq_16 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql index 09d94d52ef..08cb56bfde 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -344,93 +344,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql index c5454a0129..23f7234c6e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 GROUP BY metric_time__day @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index b90255039e..72735021e2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -71,22 +71,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index b4787d2f42..ccd562cfa6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_10.metric_time__month AS metric_time__month - , SUM(bookings_monthly_source_src_10026.bookings_monthly) AS bookings_last_month + , SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month FROM ( -- Time Spine SELECT @@ -19,9 +19,9 @@ FROM ( DATE_TRUNC('month', ds) ) subq_10 INNER JOIN - ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) + DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) GROUP BY subq_10.metric_time__month ) subq_15 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql index e1cc5bd14d..b833c0ffae 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index 951dcdff39..5138fe8ae6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 83178f0c14..cfe4bb809a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index f0bc28e9cd..b9e4162413 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('week', ds) AS metric_time__week , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__week @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql index 2cdcb2616c..83c1b130c2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql index b74c9743ea..197f4d5430 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql index fcb6d69757..3ebcc29772 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index e27e0c485b..89f6dcf4d2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__quarter @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index d36316e0fc..4f5c379351 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -541,93 +541,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index 37087a66a3..1f8ce4023a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -45,7 +45,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 84d1cf5a26..aab4084404 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -542,93 +542,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index 6ba8a150b5..6df1bd72d2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -46,7 +46,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 00751944c1..45894aea50 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -134,93 +134,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -453,93 +453,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 ) subq_7 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index 220048d458..526089b4ce 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14' GROUP BY @@ -48,7 +48,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 ON DATEADD(day, -14, subq_25.ds) = subq_23.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql index fe6e5c73bc..b1a5656c3f 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql @@ -327,93 +327,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql index 41a635c509..866ba0a41b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -15,15 +15,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_14.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_14 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_14.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_14.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_14.ds) ) ) subq_15 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql index d929bf612f..626adce121 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -444,93 +444,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ) subq_10 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index 0877a874ef..085c58e4f4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -15,12 +15,12 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS booking__ds__day - , SUM(bookings_source_src_10001.booking_value) AS booking_value + , SUM(bookings_source_src_28001.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON - DATEADD(week, -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_10001.ds) + DATEADD(week, -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_28001.ds) GROUP BY subq_17.ds ) subq_21 @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql index 3d89fd7428..4093b6845c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -220,93 +220,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index 499aca941a..56f1d26f59 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATEADD(day, -5, subq_11.ds) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql index d6453f67c7..3552f891cc 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -356,93 +356,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 @@ -577,93 +577,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -794,93 +794,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_17 ) subq_18 ) subq_19 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql index f029a81e17..78837fdd96 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_25 GROUP BY metric_time__day @@ -51,7 +51,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_30 GROUP BY metric_time__day @@ -75,7 +75,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_37 GROUP BY metric_time__day @@ -95,7 +95,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_42 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index 3745236525..ded26bc259 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -252,93 +252,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index 2f88ad6d9b..611927c9a2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -38,7 +38,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 ON DATEADD(day, -5, subq_17.ds) = subq_15.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index 980f92eb32..b0fa998f59 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -145,93 +145,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -369,93 +369,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ) subq_10 ) subq_11 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index 259a0e175f..fc648c54b6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_20 @@ -50,7 +50,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_29 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql index 1b133d12e5..eac718f93e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql @@ -154,93 +154,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -323,62 +323,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -534,93 +534,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -703,62 +703,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -899,93 +899,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql index 9291d22ff3..14649c62dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql @@ -22,14 +22,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - bookings_source_src_10001.is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.is_instant AS booking__is_instant + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_40 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_44 @@ -45,7 +45,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT subq_47.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_47.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -55,12 +55,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_47 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_47.listing = listings_latest_src_10005.listing_id + subq_47.listing = listings_latest_src_28005.listing_id ) subq_52 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_56 @@ -78,7 +78,7 @@ FROM ( SELECT is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_59 WHERE booking__is_instant ) subq_63 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql index 82f140294f..3cc6820071 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql index 8847100fdc..e9df61ae2f 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql index 11e4dff211..b94d38afb3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql @@ -237,93 +237,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql index 3518d5fc2e..82beb8296d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -34,7 +34,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql index a1d16ea249..db15a1e982 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql @@ -241,93 +241,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql index e339e91aa9..e17438d2ae 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_14 ON DATEADD(day, -5, subq_16.ds) = subq_14.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql index 4f18ff2932..4d62ef95b3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index c75e71d99a..1b7dbc4725 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql index 5af7aea865..b7ef21c966 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql index a5955b3432..272991a8dc 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql index 180dfaad3d..7db0055b6d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index 000d37818c..ee1dcbf475 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATEADD(day, -5, subq_10.metric_time__day) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index dac27d61e8..dce7659bbc 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -333,93 +333,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index 2cfdcf0b81..7412a7d091 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -22,15 +22,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_15.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_15 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_15.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_15.ds - INTERVAL 2 day + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_15.ds - INTERVAL 2 day ) ) subq_16 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql index 27a258a125..ea8a884590 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -344,93 +344,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql index c5454a0129..23f7234c6e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 GROUP BY metric_time__day @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index d00d58635a..243d2d1af4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -71,22 +71,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index 2100e55cf9..9e93cbb724 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_10.metric_time__month AS metric_time__month - , SUM(bookings_monthly_source_src_10026.bookings_monthly) AS bookings_last_month + , SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month FROM ( -- Time Spine SELECT @@ -19,9 +19,9 @@ FROM ( DATE_TRUNC('month', ds) ) subq_10 INNER JOIN - ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - subq_10.metric_time__month - INTERVAL 1 month = DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) + subq_10.metric_time__month - INTERVAL 1 month = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) GROUP BY subq_10.metric_time__month ) subq_15 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql index ccff1ccbda..7128b81a47 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index 951dcdff39..5138fe8ae6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index b31ab7c7a4..a18f1a3e30 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index f0bc28e9cd..b9e4162413 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('week', ds) AS metric_time__week , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__week @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql index 66adccbcb3..c04aa961af 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql index ab63aa1b72..b92618b957 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - INTERVAL 14 day = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql index d4e7461efa..bd5832637c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index 35ac5de9b8..02b4702e42 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__quarter @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - INTERVAL 14 day = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index c097b9db2b..22d0da11b5 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -541,93 +541,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index a0072f2846..d93f426343 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -45,7 +45,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON subq_28.ds - INTERVAL 1 month = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index e0de6f7471..5cb9811632 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -542,93 +542,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index 51b034d8f7..b302d98946 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -46,7 +46,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON subq_28.ds - INTERVAL 1 month = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 4b04595621..75b7558130 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -134,93 +134,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -453,93 +453,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 ) subq_7 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index 5c12e542b8..4cb0fa5704 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14' GROUP BY @@ -48,7 +48,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 ON subq_25.ds - INTERVAL 14 day = subq_23.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql index 1ab8984ddd..5af1f633e1 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql @@ -327,93 +327,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql index eb2f7e9d77..e2ce4906a7 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -15,15 +15,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_14.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_14 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_14.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_14.ds - INTERVAL 2 day + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_14.ds - INTERVAL 2 day ) ) subq_15 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql index e4342dee47..7ba9d4567b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -444,93 +444,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ) subq_10 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index 4b7b7696ca..61c03608e8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -15,12 +15,12 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS booking__ds__day - , SUM(bookings_source_src_10001.booking_value) AS booking_value + , SUM(bookings_source_src_28001.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON - subq_17.ds - INTERVAL 1 week = DATE_TRUNC('day', bookings_source_src_10001.ds) + subq_17.ds - INTERVAL 1 week = DATE_TRUNC('day', bookings_source_src_28001.ds) GROUP BY subq_17.ds ) subq_21 @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql index 6a590cf30e..fbba0c8a66 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -220,93 +220,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index 16098bbf2a..c2a635c12c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON subq_11.ds - INTERVAL 5 day = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql index b26ad25ccf..2d28d5feb7 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -356,93 +356,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 @@ -577,93 +577,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -794,93 +794,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_17 ) subq_18 ) subq_19 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql index f029a81e17..78837fdd96 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_25 GROUP BY metric_time__day @@ -51,7 +51,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_30 GROUP BY metric_time__day @@ -75,7 +75,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_37 GROUP BY metric_time__day @@ -95,7 +95,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_42 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index 29f0d4f029..8393f42f8f 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -252,93 +252,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index 352eb3c495..4cf7ae57ba 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -38,7 +38,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 ON subq_17.ds - INTERVAL 5 day = subq_15.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index fb24433554..b6024d9277 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -145,93 +145,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -369,93 +369,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ) subq_10 ) subq_11 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index 259a0e175f..fc648c54b6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_20 @@ -50,7 +50,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_29 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql index 187b63164b..25419e889e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql @@ -154,93 +154,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -323,62 +323,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -534,93 +534,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -703,62 +703,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -899,93 +899,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql index 9291d22ff3..14649c62dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql @@ -22,14 +22,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - bookings_source_src_10001.is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.is_instant AS booking__is_instant + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_40 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_44 @@ -45,7 +45,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT subq_47.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_47.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -55,12 +55,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_47 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_47.listing = listings_latest_src_10005.listing_id + subq_47.listing = listings_latest_src_28005.listing_id ) subq_52 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_56 @@ -78,7 +78,7 @@ FROM ( SELECT is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_59 WHERE booking__is_instant ) subq_63 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql index bb2b23ea19..92db22a335 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql index 86cfb2c126..2cd763bf76 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON subq_15.ds - INTERVAL 5 day = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql index 271d68e06b..192e070ed7 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql @@ -237,93 +237,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql index 85dd4f88b4..af16b573cd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -34,7 +34,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON subq_15.ds - INTERVAL 5 day = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql index 7275a54b26..1a2ce986ce 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql @@ -241,93 +241,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql index af3ea6e9ad..7fe8fe2dc8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_14 ON subq_16.ds - INTERVAL 5 day = subq_14.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql index 1f55db2271..df42cd08d1 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index c75e71d99a..1b7dbc4725 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql index 10afa5e97a..692ba28311 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql index d972aa60d9..7c15aff8a3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - INTERVAL 14 day = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql index 0fa8490adc..7c503cf26e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index cdb85bb4a8..0c95d432b8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON subq_10.metric_time__day - INTERVAL 5 day = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 32ffe9fc91..f7f967a868 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -333,93 +333,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index cdb7bf50af..ae64ce456a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -22,15 +22,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_15.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_15 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_15.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_15.ds - MAKE_INTERVAL(days => 2) + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_15.ds - MAKE_INTERVAL(days => 2) ) ) subq_16 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql index 27a258a125..ea8a884590 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -344,93 +344,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql index c5454a0129..23f7234c6e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 GROUP BY metric_time__day @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 12125aa60f..95226e4eb9 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -71,22 +71,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index a0133ad59a..314a91a06c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_10.metric_time__month AS metric_time__month - , SUM(bookings_monthly_source_src_10026.bookings_monthly) AS bookings_last_month + , SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month FROM ( -- Time Spine SELECT @@ -19,9 +19,9 @@ FROM ( DATE_TRUNC('month', ds) ) subq_10 INNER JOIN - ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - subq_10.metric_time__month - MAKE_INTERVAL(months => 1) = DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) + subq_10.metric_time__month - MAKE_INTERVAL(months => 1) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) GROUP BY subq_10.metric_time__month ) subq_15 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql index ccff1ccbda..7128b81a47 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index 951dcdff39..5138fe8ae6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index b31ab7c7a4..a18f1a3e30 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index f0bc28e9cd..b9e4162413 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('week', ds) AS metric_time__week , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__week @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql index cf7957998a..ba751be035 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql index 9d2241ae62..c71c75b485 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql index c9cda7dd4d..ec4e767aca 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index 11318fe1b8..4e2759b5d9 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__quarter @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 96c9c8be34..296c677724 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -541,93 +541,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index 32320774a5..0ec2c2c404 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -45,7 +45,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON subq_28.ds - MAKE_INTERVAL(months => 1) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 1ed80e7813..f4c09e0f1c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -542,93 +542,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index e90987f210..3835603ac1 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -46,7 +46,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON subq_28.ds - MAKE_INTERVAL(months => 1) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 8251b2b71d..ca417f07cf 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -134,93 +134,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -453,93 +453,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 ) subq_7 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index ba4dc8b3bd..a43927c170 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14' GROUP BY @@ -48,7 +48,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 ON subq_25.ds - MAKE_INTERVAL(days => 14) = subq_23.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql index 842d788887..9f6aaa19c3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql @@ -327,93 +327,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql index 05f72d1d51..d021503497 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -15,15 +15,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_14.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_14 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_14.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_14.ds - MAKE_INTERVAL(days => 2) + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_14.ds - MAKE_INTERVAL(days => 2) ) ) subq_15 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 7c12252be8..270ee8720a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -444,93 +444,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ) subq_10 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index f5af21c4f3..bb2d834047 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -15,12 +15,12 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS booking__ds__day - , SUM(bookings_source_src_10001.booking_value) AS booking_value + , SUM(bookings_source_src_28001.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON - subq_17.ds - MAKE_INTERVAL(weeks => 1) = DATE_TRUNC('day', bookings_source_src_10001.ds) + subq_17.ds - MAKE_INTERVAL(weeks => 1) = DATE_TRUNC('day', bookings_source_src_28001.ds) GROUP BY subq_17.ds ) subq_21 @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql index 9a5336c82c..38816518fd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -220,93 +220,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index e3b62245ff..0b538a304a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON subq_11.ds - MAKE_INTERVAL(days => 5) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql index b26ad25ccf..2d28d5feb7 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -356,93 +356,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 @@ -577,93 +577,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -794,93 +794,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_17 ) subq_18 ) subq_19 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql index f029a81e17..78837fdd96 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_25 GROUP BY metric_time__day @@ -51,7 +51,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_30 GROUP BY metric_time__day @@ -75,7 +75,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_37 GROUP BY metric_time__day @@ -95,7 +95,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_42 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index d0444a46bd..7f1880083e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -252,93 +252,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index f4ea8ebd35..9a38bf2182 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -38,7 +38,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 ON subq_17.ds - MAKE_INTERVAL(days => 5) = subq_15.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index fb24433554..b6024d9277 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -145,93 +145,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -369,93 +369,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ) subq_10 ) subq_11 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index 259a0e175f..fc648c54b6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_20 @@ -50,7 +50,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_29 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql index 187b63164b..25419e889e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql @@ -154,93 +154,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -323,62 +323,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -534,93 +534,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -703,62 +703,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -899,93 +899,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql index 9291d22ff3..14649c62dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql @@ -22,14 +22,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - bookings_source_src_10001.is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.is_instant AS booking__is_instant + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_40 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_44 @@ -45,7 +45,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT subq_47.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_47.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -55,12 +55,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_47 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_47.listing = listings_latest_src_10005.listing_id + subq_47.listing = listings_latest_src_28005.listing_id ) subq_52 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_56 @@ -78,7 +78,7 @@ FROM ( SELECT is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_59 WHERE booking__is_instant ) subq_63 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql index 77de883a2a..f76ae0aca9 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql index 0a29ca1c32..dcf61d5017 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON subq_15.ds - MAKE_INTERVAL(days => 5) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql index add83b8ae1..41f0e1b70c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql @@ -237,93 +237,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql index 8f24d0125f..e5b6f01b58 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -34,7 +34,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON subq_15.ds - MAKE_INTERVAL(days => 5) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql index 7dfe3452d8..3fa4be6986 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql @@ -241,93 +241,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql index aa018bb438..a6a237f85e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_14 ON subq_16.ds - MAKE_INTERVAL(days => 5) = subq_14.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql index 1f55db2271..df42cd08d1 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index c75e71d99a..1b7dbc4725 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql index a1e12ed314..906ccac318 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql index 2def488e77..3daea0d8e2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql index 96b856c84c..4e00e95c17 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index f16c01821d..c29d0d741b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON subq_10.metric_time__day - MAKE_INTERVAL(days => 5) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 5122641c69..7f8a2e0812 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -333,93 +333,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index c5757a4c54..d998382fb8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -22,15 +22,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_15.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_15 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_15.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_15.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_15.ds) ) ) subq_16 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql index e7d5d11cf3..80cde693e4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -344,93 +344,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql index c5454a0129..23f7234c6e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 GROUP BY metric_time__day @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index b90255039e..72735021e2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -71,22 +71,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index b4787d2f42..ccd562cfa6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_10.metric_time__month AS metric_time__month - , SUM(bookings_monthly_source_src_10026.bookings_monthly) AS bookings_last_month + , SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month FROM ( -- Time Spine SELECT @@ -19,9 +19,9 @@ FROM ( DATE_TRUNC('month', ds) ) subq_10 INNER JOIN - ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) + DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) GROUP BY subq_10.metric_time__month ) subq_15 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql index a5a906e570..abe671054c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index 951dcdff39..5138fe8ae6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 40fae76f03..7657920261 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index f0bc28e9cd..b9e4162413 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('week', ds) AS metric_time__week , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__week @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql index 7c21fd1a6f..5ff5134d8e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql index b74c9743ea..197f4d5430 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 3c8a61cea6..496cd41b91 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index e27e0c485b..89f6dcf4d2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__quarter @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index f2ef406155..0be63111b8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -541,93 +541,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index 37087a66a3..1f8ce4023a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -45,7 +45,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index d53de03e03..7b9d63c675 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -542,93 +542,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index 6ba8a150b5..6df1bd72d2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -46,7 +46,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 5876792745..a1e9adacf4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -134,93 +134,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -453,93 +453,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 ) subq_7 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index 220048d458..526089b4ce 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14' GROUP BY @@ -48,7 +48,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 ON DATEADD(day, -14, subq_25.ds) = subq_23.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql index 2f0442fc2b..c010b8557b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql @@ -327,93 +327,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0_optimized.sql index 41a635c509..866ba0a41b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -15,15 +15,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_14.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_14 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_14.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_14.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_14.ds) ) ) subq_15 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 6a486ea390..d04e53e5ae 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -444,93 +444,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ) subq_10 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index 0877a874ef..085c58e4f4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -15,12 +15,12 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS booking__ds__day - , SUM(bookings_source_src_10001.booking_value) AS booking_value + , SUM(bookings_source_src_28001.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON - DATEADD(week, -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_10001.ds) + DATEADD(week, -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_28001.ds) GROUP BY subq_17.ds ) subq_21 @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql index 47d0172a81..b988557a93 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -220,93 +220,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index 499aca941a..56f1d26f59 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATEADD(day, -5, subq_11.ds) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql index ff7e980b45..9cf45debd4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -356,93 +356,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 @@ -577,93 +577,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -794,93 +794,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_17 ) subq_18 ) subq_19 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0_optimized.sql index f029a81e17..78837fdd96 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_25 GROUP BY metric_time__day @@ -51,7 +51,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_30 GROUP BY metric_time__day @@ -75,7 +75,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_37 GROUP BY metric_time__day @@ -95,7 +95,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_42 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index 03a18bf6f8..ab6f852ebf 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -252,93 +252,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index 2f88ad6d9b..611927c9a2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -38,7 +38,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 ON DATEADD(day, -5, subq_17.ds) = subq_15.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index 8837e7eb6f..acc70ddd79 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -145,93 +145,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -369,93 +369,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ) subq_10 ) subq_11 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index 259a0e175f..fc648c54b6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_20 @@ -50,7 +50,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_29 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0.sql index beada6191c..28420deb3e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0.sql @@ -154,93 +154,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -323,62 +323,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -534,93 +534,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -703,62 +703,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -899,93 +899,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql index 9291d22ff3..14649c62dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql @@ -22,14 +22,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - bookings_source_src_10001.is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.is_instant AS booking__is_instant + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_40 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_44 @@ -45,7 +45,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT subq_47.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_47.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -55,12 +55,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_47 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_47.listing = listings_latest_src_10005.listing_id + subq_47.listing = listings_latest_src_28005.listing_id ) subq_52 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_56 @@ -78,7 +78,7 @@ FROM ( SELECT is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_59 WHERE booking__is_instant ) subq_63 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql index 49127e83eb..ad8200aea3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0_optimized.sql index 8847100fdc..e9df61ae2f 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql index 0a161d477b..f269a9cada 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql @@ -237,93 +237,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0_optimized.sql index 3518d5fc2e..82beb8296d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -34,7 +34,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql index 6e88408a60..b77e206731 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql @@ -241,93 +241,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0_optimized.sql index e339e91aa9..e17438d2ae 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_14 ON DATEADD(day, -5, subq_16.ds) = subq_14.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql index 6ead2b5096..510862428a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index c75e71d99a..1b7dbc4725 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql index 636b062f2b..1fe0aa0ce2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0_optimized.sql index a5955b3432..272991a8dc 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql index 60ee43eaab..a00d889d96 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index 000d37818c..ee1dcbf475 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATEADD(day, -5, subq_10.metric_time__day) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index ffd4cb2473..bf9815e472 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -333,93 +333,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index c5757a4c54..d998382fb8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -22,15 +22,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_15.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_15 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_15.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_15.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_15.ds) ) ) subq_16 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql index 00d3bc7ff5..dbf74a0526 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -344,93 +344,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0_optimized.sql index c5454a0129..23f7234c6e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 GROUP BY metric_time__day @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index b90255039e..72735021e2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -71,22 +71,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index b4787d2f42..ccd562cfa6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_10.metric_time__month AS metric_time__month - , SUM(bookings_monthly_source_src_10026.bookings_monthly) AS bookings_last_month + , SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month FROM ( -- Time Spine SELECT @@ -19,9 +19,9 @@ FROM ( DATE_TRUNC('month', ds) ) subq_10 INNER JOIN - ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) + DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) GROUP BY subq_10.metric_time__month ) subq_15 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql index 223357703f..8252ab84a8 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index 951dcdff39..5138fe8ae6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 39fe9c05df..f3b7f76b55 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index f0bc28e9cd..b9e4162413 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('week', ds) AS metric_time__week , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__week @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql index 459c61eab8..af8ee6f08a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0_optimized.sql index b74c9743ea..197f4d5430 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 2cd5ceda5e..dcaf2040bf 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index e27e0c485b..89f6dcf4d2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__quarter @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 4aa1b91114..e0166aec7d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -541,93 +541,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index 37087a66a3..1f8ce4023a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -45,7 +45,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 15c6c1b962..69d6919302 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -542,93 +542,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index 6ba8a150b5..6df1bd72d2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -46,7 +46,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 47fb5d6bbd..c1c21d252e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -134,93 +134,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -453,93 +453,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 ) subq_7 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index 220048d458..526089b4ce 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14' GROUP BY @@ -48,7 +48,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 ON DATEADD(day, -14, subq_25.ds) = subq_23.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql index 4e35738c6e..f3f1612e00 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql @@ -327,93 +327,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0_optimized.sql index 41a635c509..866ba0a41b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -15,15 +15,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_14.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_14 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_14.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_14.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_14.ds) ) ) subq_15 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql index a75e34f427..335341b000 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -444,93 +444,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ) subq_10 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index 0877a874ef..085c58e4f4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -15,12 +15,12 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS booking__ds__day - , SUM(bookings_source_src_10001.booking_value) AS booking_value + , SUM(bookings_source_src_28001.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON - DATEADD(week, -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_10001.ds) + DATEADD(week, -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_28001.ds) GROUP BY subq_17.ds ) subq_21 @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql index 1bb45d6b69..1cab837f78 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -220,93 +220,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index 499aca941a..56f1d26f59 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATEADD(day, -5, subq_11.ds) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql index 1f9414eb9f..a172445bdd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -356,93 +356,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 @@ -577,93 +577,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -794,93 +794,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_17 ) subq_18 ) subq_19 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0_optimized.sql index f029a81e17..78837fdd96 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_25 GROUP BY metric_time__day @@ -51,7 +51,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_30 GROUP BY metric_time__day @@ -75,7 +75,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_37 GROUP BY metric_time__day @@ -95,7 +95,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_42 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index a9d115b189..fd8311f18a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -252,93 +252,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index 2f88ad6d9b..611927c9a2 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -38,7 +38,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 ON DATEADD(day, -5, subq_17.ds) = subq_15.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index 63da304da6..975ec9ee9c 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -145,93 +145,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -369,93 +369,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ) subq_10 ) subq_11 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index 259a0e175f..fc648c54b6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_20 @@ -50,7 +50,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_29 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0.sql index d100505cdd..fd0cd1a4ff 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0.sql @@ -154,93 +154,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -323,62 +323,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -534,93 +534,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -703,62 +703,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -899,93 +899,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql index 9291d22ff3..14649c62dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql @@ -22,14 +22,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - bookings_source_src_10001.is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.is_instant AS booking__is_instant + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_40 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_44 @@ -45,7 +45,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT subq_47.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_47.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -55,12 +55,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_47 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_47.listing = listings_latest_src_10005.listing_id + subq_47.listing = listings_latest_src_28005.listing_id ) subq_52 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_56 @@ -78,7 +78,7 @@ FROM ( SELECT is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_59 WHERE booking__is_instant ) subq_63 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql index fe86604a32..d69db7c4d1 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0_optimized.sql index 8847100fdc..e9df61ae2f 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql index da0d9e581c..eb9ec0165d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql @@ -237,93 +237,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0_optimized.sql index 3518d5fc2e..82beb8296d 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -34,7 +34,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql index 959205b7cf..f1450394bf 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql @@ -241,93 +241,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0_optimized.sql index e339e91aa9..e17438d2ae 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_14 ON DATEADD(day, -5, subq_16.ds) = subq_14.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql index b9c7e46fdf..ef9c33f743 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index c75e71d99a..1b7dbc4725 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql index 756e1b0598..0701b57ece 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0_optimized.sql index a5955b3432..272991a8dc 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql index 3fd74c9273..b345b836f4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index 000d37818c..ee1dcbf475 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATEADD(day, -5, subq_10.metric_time__day) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 3f7ae8edb2..b1008b201f 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -333,93 +333,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql index 992525b6a8..1cbb7e47da 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -22,15 +22,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_15.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_15 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_15.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATE_ADD('day', -2, subq_15.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATE_ADD('day', -2, subq_15.ds) ) ) subq_16 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0.sql index fb69a89d24..3463247221 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -344,93 +344,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0_optimized.sql index c5454a0129..23f7234c6e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 GROUP BY metric_time__day @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 028f2a7ede..882a8d8d02 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -71,22 +71,22 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_monthly_source' SELECT - bookings_monthly_source_src_10026.bookings_monthly - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS monthly_ds__extract_month - , DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__month - , DATE_TRUNC('quarter', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__quarter - , DATE_TRUNC('year', bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__year - , EXTRACT(year FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_year - , EXTRACT(quarter FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_quarter - , EXTRACT(month FROM bookings_monthly_source_src_10026.ds) AS booking__monthly_ds__extract_month - , bookings_monthly_source_src_10026.listing_id AS listing - , bookings_monthly_source_src_10026.listing_id AS booking__listing - FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + bookings_monthly_source_src_16000.bookings_monthly + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS monthly_ds__extract_month + , DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__month + , DATE_TRUNC('quarter', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__quarter + , DATE_TRUNC('year', bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__year + , EXTRACT(year FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_year + , EXTRACT(quarter FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_quarter + , EXTRACT(month FROM bookings_monthly_source_src_16000.ds) AS booking__monthly_ds__extract_month + , bookings_monthly_source_src_16000.listing_id AS listing + , bookings_monthly_source_src_16000.listing_id AS booking__listing + FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql index 98cdb52c58..8caca07dd3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql @@ -9,7 +9,7 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_10.metric_time__month AS metric_time__month - , SUM(bookings_monthly_source_src_10026.bookings_monthly) AS bookings_last_month + , SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month FROM ( -- Time Spine SELECT @@ -19,9 +19,9 @@ FROM ( DATE_TRUNC('month', ds) ) subq_10 INNER JOIN - ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_10026 + ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000 ON - DATE_ADD('month', -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_10026.ds) + DATE_ADD('month', -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds) GROUP BY subq_10.metric_time__month ) subq_15 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql index c9d33798ea..953276bcd3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0_optimized.sql index 951dcdff39..5138fe8ae6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 5d06c7a0d2..8118b0cde6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql index f0bc28e9cd..b9e4162413 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('week', ds) AS metric_time__week , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__week @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql index 43f95e824e..b069367191 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0_optimized.sql index 5f354aaaa1..9f6388e314 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_ADD('day', -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 6c1b602a7f..fad85dcb51 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql index 169d48de3e..2be93c882e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__quarter @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_ADD('day', -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 5d14885e4b..19653dcf27 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -541,93 +541,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql index f624ee033e..8fc39c111b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -45,7 +45,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATE_ADD('month', -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index c6f3bc3839..91a46fe69e 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -542,93 +542,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql index acb4b59e0d..b1468efa5a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 ON DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day @@ -46,7 +46,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATE_ADD('month', -1, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 2023c3df15..efd0704145 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -134,93 +134,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -453,93 +453,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 ) subq_7 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql index cd209ec328..87a9badc38 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql @@ -22,7 +22,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_18 WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14' GROUP BY @@ -48,7 +48,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_23 ON DATE_ADD('day', -14, subq_25.ds) = subq_23.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql index 1ef95b4fa8..0568dd7d09 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql @@ -327,93 +327,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0_optimized.sql index 2198bb77f2..cb5e71ee25 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0_optimized.sql @@ -15,15 +15,15 @@ FROM ( -- Join Self Over Time Range SELECT subq_14.ds AS metric_time__day - , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_28001.guest_id AS bookers FROM ***************************.mf_time_spine subq_14 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_14.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATE_ADD('day', -2, subq_14.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATE_ADD('day', -2, subq_14.ds) ) ) subq_15 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 254fd83af1..e927d96603 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -226,93 +226,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON @@ -444,93 +444,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ) subq_10 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql index a972ba06b2..9608d7923b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql @@ -15,12 +15,12 @@ FROM ( -- Compute Metrics via Expressions SELECT subq_17.ds AS booking__ds__day - , SUM(bookings_source_src_10001.booking_value) AS booking_value + , SUM(bookings_source_src_28001.booking_value) AS booking_value FROM ***************************.mf_time_spine subq_17 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON - DATE_ADD('week', -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_10001.ds) + DATE_ADD('week', -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_28001.ds) GROUP BY subq_17.ds ) subq_21 @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , COUNT(DISTINCT guest_id) AS bookers - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql index b3f5ff2641..ff7d5e25e4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -220,93 +220,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql index 325338c2aa..46a02303b5 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql @@ -17,7 +17,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATE_ADD('day', -5, subq_11.ds) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0.sql index 77182f1a98..ede4cc3102 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -356,93 +356,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 @@ -577,93 +577,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -794,93 +794,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_17 ) subq_18 ) subq_19 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0_optimized.sql index f029a81e17..78837fdd96 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_25 GROUP BY metric_time__day @@ -51,7 +51,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_30 GROUP BY metric_time__day @@ -75,7 +75,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_37 GROUP BY metric_time__day @@ -95,7 +95,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_42 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index 809a359c47..1695f37106 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -252,93 +252,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql index 19220dcfbd..03646ba7d0 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql @@ -38,7 +38,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 ON DATE_ADD('day', -5, subq_17.ds) = subq_15.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql index fc70bfb692..fec5a20b16 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql @@ -145,93 +145,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -369,93 +369,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ) subq_10 ) subq_11 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql index 259a0e175f..fc648c54b6 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_20 @@ -50,7 +50,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_29 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0.sql index 90dc235c4f..063f570ca7 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0.sql @@ -154,93 +154,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -323,62 +323,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -534,93 +534,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -703,62 +703,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -899,93 +899,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql index 9291d22ff3..14649c62dd 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql @@ -22,14 +22,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - bookings_source_src_10001.is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + bookings_source_src_28001.is_instant AS booking__is_instant + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_40 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_44 @@ -45,7 +45,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT subq_47.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_47.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -55,12 +55,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_47 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_47.listing = listings_latest_src_10005.listing_id + subq_47.listing = listings_latest_src_28005.listing_id ) subq_52 WHERE (listing__is_lux_latest) AND (booking__is_instant) ) subq_56 @@ -78,7 +78,7 @@ FROM ( SELECT is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_59 WHERE booking__is_instant ) subq_63 diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql index 1cdd62e536..56e552e360 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0_optimized.sql index 5b41336ae0..0284eb56c4 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATE_ADD('day', -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql index 7c31115a3d..ded5076dda 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql @@ -237,93 +237,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0_optimized.sql index a4ccb125df..68af9338c0 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0_optimized.sql @@ -34,7 +34,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 ON DATE_ADD('day', -5, subq_15.ds) = subq_13.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql index a750f559b1..b0f716b25b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql @@ -241,93 +241,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0_optimized.sql index 80e683eb4c..bc54c5e53a 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0_optimized.sql @@ -33,7 +33,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_14 ON DATE_ADD('day', -5, subq_16.ds) = subq_14.metric_time__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql index cb6a6fd66f..41630ee0e3 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql index c75e71d99a..1b7dbc4725 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql index da3638a490..fe159ef2fb 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0_optimized.sql index 32a35c9e3f..9768c7970b 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY booking__ds__day @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS booking__ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_ADD('day', -14, subq_22.ds) = subq_20.booking__ds__day diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql index 60b6f5da17..bc434f18c0 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0_optimized.sql index 4d5e6b4606..5f9927ab43 100644 --- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0_optimized.sql @@ -23,7 +23,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 ON DATE_ADD('day', -5, subq_10.metric_time__day) = subq_9.metric_time__day diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql index 8fc178500e..174821d540 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -191,32 +191,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10009.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC(users_latest_src_10009.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS user__ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index b9ba9e5eb5..b2b0b8cb89 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,13 +6,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE user__home_state_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql index 7f49650fa0..8fdb02c3a8 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10009.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC(users_latest_src_10009.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS user__ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql index 96767d53ab..8be14ae725 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY listing__is_lux_latest , user__home_state_latest diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0.sql index adf9b6f282..0bf21c9a36 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -191,32 +191,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index b9ba9e5eb5..b2b0b8cb89 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,13 +6,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE user__home_state_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql index 2b037ef415..5fd13a23f2 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql index 163755f10b..1249bf29d4 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -191,32 +191,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index b9ba9e5eb5..b2b0b8cb89 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,13 +6,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE user__home_state_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql index 33e3092700..884b765da5 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0.sql index 163755f10b..1249bf29d4 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -191,32 +191,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index b9ba9e5eb5..b2b0b8cb89 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,13 +6,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE user__home_state_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql index 33e3092700..884b765da5 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0.sql index 8c0a50927d..a5c3a47e46 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -191,32 +191,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index b9ba9e5eb5..b2b0b8cb89 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,13 +6,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE user__home_state_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql index ee5e923bea..5258faf635 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0.sql index 01fe54c305..f8c8125277 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -191,32 +191,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index b9ba9e5eb5..b2b0b8cb89 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,13 +6,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE user__home_state_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql index 62f316a9b1..2d95b7bd1e 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0.sql index fef72caded..9015182e72 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -126,62 +126,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -191,32 +191,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index b9ba9e5eb5..b2b0b8cb89 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,13 +6,13 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id ) subq_8 WHERE user__home_state_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql index 221005d99e..9dea907a17 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql @@ -66,62 +66,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 FULL OUTER JOIN ( -- Pass Only Elements: ['home_state_latest', 'user'] @@ -131,32 +131,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_1 ) subq_2 ON diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql index a3539996b7..bee3a232b6 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql @@ -1,13 +1,13 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest'] SELECT - listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml index 3ae358906f..c76484d3b1 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml @@ -1,417 +1,417 @@ - + - + - - + + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - + + - - - - + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - - - + + + - + - + - + - + - + - + - - + + - + @@ -420,387 +420,387 @@ - + - + - + - + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml index d90feed1e9..26db0cae48 100644 --- a/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml +++ b/metricflow/test/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml @@ -1,209 +1,209 @@ - + - + - - + + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + - + - + - + - + - + - + - - + + - + @@ -212,337 +212,337 @@ - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql index 27c6eb531c..6a7bece951 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql index 13de629b1b..0e337eec64 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_fill_nulls__plan0_optimized.sql @@ -14,15 +14,15 @@ FROM ( -- Aggregate Measures SELECT subq_13.ds AS metric_time__day - , COUNT(DISTINCT bookings_source_src_10001.guest_id) AS bookers + , COUNT(DISTINCT bookings_source_src_28001.guest_id) AS bookers FROM ***************************.mf_time_spine subq_13 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC(bookings_source_src_10001.ds, day) <= subq_13.ds + DATE_TRUNC(bookings_source_src_28001.ds, day) <= subq_13.ds ) AND ( - DATE_TRUNC(bookings_source_src_10001.ds, day) > DATE_SUB(CAST(subq_13.ds AS DATETIME), INTERVAL 2 day) + DATE_TRUNC(bookings_source_src_28001.ds, day) > DATE_SUB(CAST(subq_13.ds AS DATETIME), INTERVAL 2 day) ) GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql index e947605f1b..21e105dc47 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -140,93 +140,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -455,93 +455,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index b7245e8e9e..6b4e3d1525 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_19 GROUP BY metric_time__day @@ -55,7 +55,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATE_SUB(CAST(subq_28.ds AS DATETIME), INTERVAL 14 day) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql index b0aeaf61c0..b140a40589 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index f3e2c0fd66..ea9c03e765 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql index 3cacfa94bb..57771b4b6f 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0.sql @@ -131,93 +131,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index daae249ea8..063b7bdc40 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -27,7 +27,7 @@ FROM ( SELECT DATE_TRUNC(ds, month) AS metric_time__month , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__month diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index e5bad3fb51..23345fe856 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql index 509c4a3f0d..3cb5d4ac8a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__is_instant diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index 0af9c666a8..3aaa8e32ab 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index 6ee4fa97f4..291436f549 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC(paid_at, day) AS booking__paid_at__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql index 2c75cc8393..185e823148 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index 35eb71e405..e4ea18165c 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0.sql index 6fa777e69c..c09a6f8b44 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0_optimized.sql index 2678b27790..2079863ef3 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_cumulative_fill_nulls__plan0_optimized.sql @@ -14,15 +14,15 @@ FROM ( -- Aggregate Measures SELECT subq_13.ds AS metric_time__day - , COUNT(DISTINCT bookings_source_src_10001.guest_id) AS bookers + , COUNT(DISTINCT bookings_source_src_28001.guest_id) AS bookers FROM ***************************.mf_time_spine subq_13 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_13.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_13.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_13.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_13.ds) ) GROUP BY subq_13.ds diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 75b064c07a..37194a458f 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -140,93 +140,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -455,93 +455,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index 1e88682633..7d837ba331 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_19 GROUP BY metric_time__day @@ -55,7 +55,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(day, -14, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0.sql index 00ed51b554..b0424616b1 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index 6046735dd1..88bc47bb27 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0.sql index 39954ab493..9d2c442d71 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0.sql @@ -131,93 +131,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index 530fa64f76..3f0b900958 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -27,7 +27,7 @@ FROM ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__month diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index cccd1f582e..9b37073e8e 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql index 509c4a3f0d..3cb5d4ac8a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__is_instant diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index e74ce676c6..f3f2cae0dc 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index 435f513d57..9feb4f2769 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0.sql index a4120073d6..bd90f3eb15 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index fceaee43c5..65ce5f540b 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0.sql index a97aaca50b..4af8c98b67 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0_optimized.sql index 252b566c7e..16bfac3fa1 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_fill_nulls__plan0_optimized.sql @@ -14,15 +14,15 @@ FROM ( -- Aggregate Measures SELECT subq_13.ds AS metric_time__day - , COUNT(DISTINCT bookings_source_src_10001.guest_id) AS bookers + , COUNT(DISTINCT bookings_source_src_28001.guest_id) AS bookers FROM ***************************.mf_time_spine subq_13 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_13.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_13.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_13.ds - INTERVAL 2 day + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_13.ds - INTERVAL 2 day ) GROUP BY subq_13.ds diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 00136f2a1b..f9f1c97129 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -140,93 +140,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -455,93 +455,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index a84e26d73a..afbbbac44a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_19 GROUP BY metric_time__day @@ -55,7 +55,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON subq_28.ds - INTERVAL 14 day = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0.sql index 4802554e88..e30cf6df5a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index 6046735dd1..88bc47bb27 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0.sql index d30b4202eb..9f01603d12 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0.sql @@ -131,93 +131,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index 530fa64f76..3f0b900958 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -27,7 +27,7 @@ FROM ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__month diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index 8b289e4b59..8f5d46e0f3 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql index 509c4a3f0d..3cb5d4ac8a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__is_instant diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index ad5f9623d5..188a888829 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index 435f513d57..9feb4f2769 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0.sql index b4bb80d860..e171c1d2a4 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index fceaee43c5..65ce5f540b 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0.sql index dab827f424..f84630c52b 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0_optimized.sql index 9f589cd1e0..fa843ae543 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_cumulative_fill_nulls__plan0_optimized.sql @@ -14,15 +14,15 @@ FROM ( -- Aggregate Measures SELECT subq_13.ds AS metric_time__day - , COUNT(DISTINCT bookings_source_src_10001.guest_id) AS bookers + , COUNT(DISTINCT bookings_source_src_28001.guest_id) AS bookers FROM ***************************.mf_time_spine subq_13 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_13.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_13.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > subq_13.ds - MAKE_INTERVAL(days => 2) + DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_13.ds - MAKE_INTERVAL(days => 2) ) GROUP BY subq_13.ds diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql index fd0143c3e4..1f4db0ab28 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -140,93 +140,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -455,93 +455,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index c74de45c3e..ad8d634d7d 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_19 GROUP BY metric_time__day @@ -55,7 +55,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON subq_28.ds - MAKE_INTERVAL(days => 14) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0.sql index 4802554e88..e30cf6df5a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index 6046735dd1..88bc47bb27 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0.sql index d30b4202eb..9f01603d12 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0.sql @@ -131,93 +131,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index 530fa64f76..3f0b900958 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -27,7 +27,7 @@ FROM ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__month diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index 8b289e4b59..8f5d46e0f3 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql index 509c4a3f0d..3cb5d4ac8a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__is_instant diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index ad5f9623d5..188a888829 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index 435f513d57..9feb4f2769 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0.sql index b4bb80d860..e171c1d2a4 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index fceaee43c5..65ce5f540b 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0.sql index fcc42735c6..a40769d77f 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0_optimized.sql index 2678b27790..2079863ef3 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_cumulative_fill_nulls__plan0_optimized.sql @@ -14,15 +14,15 @@ FROM ( -- Aggregate Measures SELECT subq_13.ds AS metric_time__day - , COUNT(DISTINCT bookings_source_src_10001.guest_id) AS bookers + , COUNT(DISTINCT bookings_source_src_28001.guest_id) AS bookers FROM ***************************.mf_time_spine subq_13 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_13.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_13.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_13.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_13.ds) ) GROUP BY subq_13.ds diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 4c9df3a0ec..c1a530e91e 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -140,93 +140,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -455,93 +455,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index 1e88682633..7d837ba331 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_19 GROUP BY metric_time__day @@ -55,7 +55,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(day, -14, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0.sql index e837269382..e926810abf 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index 6046735dd1..88bc47bb27 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0.sql index db647ce282..e304528703 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0.sql @@ -131,93 +131,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index 530fa64f76..3f0b900958 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -27,7 +27,7 @@ FROM ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__month diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index 857e5edf83..a67a43e4d1 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql index 509c4a3f0d..3cb5d4ac8a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__is_instant diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index f45d16e8a7..a6ff42b4bd 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index 435f513d57..9feb4f2769 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0.sql index 01f31e8ea8..3775b18a74 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index fceaee43c5..65ce5f540b 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0.sql index 43dd6528a6..3ef841df85 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0_optimized.sql index 2678b27790..2079863ef3 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_fill_nulls__plan0_optimized.sql @@ -14,15 +14,15 @@ FROM ( -- Aggregate Measures SELECT subq_13.ds AS metric_time__day - , COUNT(DISTINCT bookings_source_src_10001.guest_id) AS bookers + , COUNT(DISTINCT bookings_source_src_28001.guest_id) AS bookers FROM ***************************.mf_time_spine subq_13 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_13.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_13.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATEADD(day, -2, subq_13.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_13.ds) ) GROUP BY subq_13.ds diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 88def2a93d..75043b377e 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -140,93 +140,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -455,93 +455,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index 1e88682633..7d837ba331 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_19 GROUP BY metric_time__day @@ -55,7 +55,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATEADD(day, -14, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0.sql index ba12e7b8b5..a455b172a0 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index 6046735dd1..88bc47bb27 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0.sql index 08c84ee0ee..56ed3a2d25 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0.sql @@ -131,93 +131,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index 530fa64f76..3f0b900958 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -27,7 +27,7 @@ FROM ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__month diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index 45803115a2..c285050765 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql index 509c4a3f0d..3cb5d4ac8a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__is_instant diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index 19378dfb65..5d7ec762a9 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index 435f513d57..9feb4f2769 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0.sql index a5ac4078e3..0ef53508df 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index fceaee43c5..65ce5f540b 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0.sql index 5f29b24448..7c6e1649bf 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0.sql @@ -236,93 +236,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0_optimized.sql index 0f9b6185b0..bd7e2fb6dd 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_cumulative_fill_nulls__plan0_optimized.sql @@ -14,15 +14,15 @@ FROM ( -- Aggregate Measures SELECT subq_13.ds AS metric_time__day - , COUNT(DISTINCT bookings_source_src_10001.guest_id) AS bookers + , COUNT(DISTINCT bookings_source_src_28001.guest_id) AS bookers FROM ***************************.mf_time_spine subq_13 INNER JOIN - ***************************.fct_bookings bookings_source_src_10001 + ***************************.fct_bookings bookings_source_src_28001 ON ( - DATE_TRUNC('day', bookings_source_src_10001.ds) <= subq_13.ds + DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_13.ds ) AND ( - DATE_TRUNC('day', bookings_source_src_10001.ds) > DATE_ADD('day', -2, subq_13.ds) + DATE_TRUNC('day', bookings_source_src_28001.ds) > DATE_ADD('day', -2, subq_13.ds) ) GROUP BY subq_13.ds diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 492a9c49ea..5261b77128 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -140,93 +140,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -455,93 +455,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_8 ) subq_9 ON diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index 3568b08a42..aa46fba2f7 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -31,7 +31,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_19 GROUP BY metric_time__day @@ -55,7 +55,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_26 ON DATE_ADD('day', -14, subq_28.ds) = subq_26.metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0.sql index 3465ec6356..38e51fc60a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql index 6046735dd1..88bc47bb27 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_metric_time__plan0_optimized.sql @@ -20,7 +20,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0.sql index e7547be85f..d4a2a22ecf 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0.sql @@ -131,93 +131,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0_optimized.sql index 530fa64f76..3f0b900958 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_month__plan0_optimized.sql @@ -27,7 +27,7 @@ FROM ( SELECT DATE_TRUNC('month', ds) AS metric_time__month , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__month diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql index eda7d0100d..574c95966c 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql index 509c4a3f0d..3cb5d4ac8a 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_categorical_dimension__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__is_instant diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql index 00184e31a9..85d5ae6283 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql index 435f513d57..9feb4f2769 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_with_0_with_non_metric_time__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0.sql index 88a42744fe..780cbf9c9e 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql index fceaee43c5..65ce5f540b 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_simple_fill_nulls_without_time_spine__plan0_optimized.sql @@ -14,7 +14,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql index 6566da63ee..e774fe9832 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql index b5d0f551ed..7a71bf9f8d 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__extract_dow @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql index c900c85d78..205d20c5ea 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql index c911a6cdae..68fb5d4b63 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql index bfcfd42524..d53a60bef4 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql index f00f3b3dbd..8af84752d8 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS metric_time__extract_dow , EXTRACT(dayofyear FROM ds) AS metric_time__extract_doy , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_year diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql index 512523bad2..17972106c0 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql index 7c40985965..2ba3f9f227 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT EXTRACT(DAYOFWEEK_ISO FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__extract_dow @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql index e686d37fe4..d5afd6f550 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql index 06b73e0950..f89ef9f07c 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT EXTRACT(DAYOFWEEK_ISO FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql index 1b656f7615..5bac185c61 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql index 63ec9e8c84..bf07b1b27b 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( , EXTRACT(DAYOFWEEK_ISO 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 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_year diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql index 5eb75292c9..a0763ab3b5 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql index 0f8e829348..ab923b3448 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT EXTRACT(isodow FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__extract_dow @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - INTERVAL 14 day = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql index 96ce78b66f..09c76b3539 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql index 8d32546bd4..2aa1237558 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT EXTRACT(isodow FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql index 604339cbbf..ccafd85787 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql index 7eeb1b4238..e0533766ca 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( , EXTRACT(isodow 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 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_year diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql index d7d009c4f2..27c00f18a6 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql index 1f8a497052..c364c376c4 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT EXTRACT(isodow FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__extract_dow @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql index 96ce78b66f..09c76b3539 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql index 8d32546bd4..2aa1237558 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT EXTRACT(isodow FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql index 604339cbbf..ccafd85787 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql index 7eeb1b4238..e0533766ca 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( , EXTRACT(isodow 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 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_year diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql index 44ba96e5ab..d17a2db062 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql index 056bc3df55..3b69bcb10d 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__extract_dow @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql index 2932badd36..a277c4d690 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql index c4f195adb2..885fd8ff54 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql index 72ddf3014b..d1f3180d24 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql index a15be64a60..91c98c89ad 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( , CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS metric_time__extract_dow , EXTRACT(doy FROM ds) AS metric_time__extract_doy , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_year diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql index 8881b738c0..dfd3dcb20b 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql index 2a2b03c1cc..17dda92b0e 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT EXTRACT(dayofweekiso FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__extract_dow @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql index dd36144a7b..a8201ea29c 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql index 946008b665..1ef4b4a4e7 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT EXTRACT(dayofweekiso FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql index 914002084b..6b1fb9c4ca 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql index 47ad1ed8e1..09d874e549 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( , EXTRACT(dayofweekiso 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 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_year diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql index 56040119b9..c5e61969ff 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -441,93 +441,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ON diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0_optimized.sql index bdb1f0a610..2ab3916ac3 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0_optimized.sql @@ -21,7 +21,7 @@ FROM ( SELECT EXTRACT(DAY_OF_WEEK FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_16 GROUP BY metric_time__extract_dow @@ -41,7 +41,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_20 ON DATE_ADD('day', -14, subq_22.ds) = subq_20.metric_time__day diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0.sql index fb7231d056..e7549b14d6 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0.sql @@ -118,93 +118,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0_optimized.sql index f94a2feb9b..3384f09601 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_date_part__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT EXTRACT(DAY_OF_WEEK FROM ds) AS metric_time__extract_dow , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0.sql index c3dd078ae7..08567cdc3e 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0_optimized.sql index b12d689e8d..20e9a65c98 100644 --- a/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -28,7 +28,7 @@ FROM ( , EXTRACT(DAY_OF_WEEK 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 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_6 GROUP BY metric_time__extract_year 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 bd322979b6..6bb677070d 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 @@ -91,91 +91,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 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 68c449717a..c0d95fc9c1 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 @@ -87,4 +87,4 @@ SELECT , is_instant , is_instant AS booking__is_instant , booking_value AS booking_payments -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 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 d81bd19192..5d05bdaaff 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 @@ -103,91 +103,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 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 318a832b2c..1c9d8067a9 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 @@ -99,4 +99,4 @@ SELECT , booking_value AS discrete_booking_value_p99 , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 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 b869c6faf3..d358fe49a9 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 @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -327,93 +327,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index 15a8206ad3..3a7ad735b4 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC(paid_at, day) AS metric_time__day , SUM(booking_value) AS booking_payments - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day ) subq_19 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index ae35c7bd29..80b3cbe42f 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -91,91 +91,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/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/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 49a20ecb3e..4de651e561 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/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/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -87,4 +87,4 @@ SELECT , is_instant , is_instant AS booking__is_instant , booking_value AS booking_payments -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index b778ae6357..d507cfa515 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -103,91 +103,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index d94ca14dbe..f4cf4bec00 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -99,4 +99,4 @@ SELECT , booking_value AS discrete_booking_value_p99 , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql index 307280aa20..206195d172 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -327,93 +327,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index a44c3893c8..46a71e6b6f 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', paid_at) AS metric_time__day , SUM(booking_value) AS booking_payments - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_19 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index f452f0c6f1..3388dce9c6 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -91,91 +91,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/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/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 663ecb72c6..5421eb8d08 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/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/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -87,4 +87,4 @@ SELECT , is_instant , is_instant AS booking__is_instant , booking_value AS booking_payments -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 94f4dec0cd..d84dc7ddb7 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -103,91 +103,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 8b0c7ac030..4e5bf46c30 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -99,4 +99,4 @@ SELECT , booking_value AS discrete_booking_value_p99 , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql index 457b0adfea..262a7abb6c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -327,93 +327,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index a44c3893c8..46a71e6b6f 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', paid_at) AS metric_time__day , SUM(booking_value) AS booking_payments - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_19 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index f452f0c6f1..3388dce9c6 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -91,91 +91,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/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/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 663ecb72c6..5421eb8d08 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/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/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -87,4 +87,4 @@ SELECT , is_instant , is_instant AS booking__is_instant , booking_value AS booking_payments -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 94f4dec0cd..d84dc7ddb7 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -103,91 +103,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 8b0c7ac030..4e5bf46c30 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -99,4 +99,4 @@ SELECT , booking_value AS discrete_booking_value_p99 , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql index 457b0adfea..262a7abb6c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -327,93 +327,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index a44c3893c8..46a71e6b6f 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', paid_at) AS metric_time__day , SUM(booking_value) AS booking_payments - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_19 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index 4203aeb61f..c39e402440 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -91,91 +91,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/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/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index d4e40843f9..f8a48e796c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/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/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -87,4 +87,4 @@ SELECT , is_instant , is_instant AS booking__is_instant , booking_value AS booking_payments -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 45717a9a72..e1280ee545 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -103,91 +103,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 99f40be20a..4279e7545e 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -99,4 +99,4 @@ SELECT , booking_value AS discrete_booking_value_p99 , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql index fe79925e2c..286fc71f31 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -327,93 +327,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index a44c3893c8..46a71e6b6f 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', paid_at) AS metric_time__day , SUM(booking_value) AS booking_payments - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_19 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index bd4191ca0f..aa381107d7 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -91,91 +91,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/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/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 58018dc4d7..e0b0390cac 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/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/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -87,4 +87,4 @@ SELECT , is_instant , is_instant AS booking__is_instant , booking_value AS booking_payments -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index a2429ac3c0..510806d5f8 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -103,91 +103,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index d973be8aa9..e44f38a400 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -99,4 +99,4 @@ SELECT , booking_value AS discrete_booking_value_p99 , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql index df99368573..7d5083d730 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -327,93 +327,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index a44c3893c8..46a71e6b6f 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', paid_at) AS metric_time__day , SUM(booking_value) AS booking_payments - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_19 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index 28d7cd941d..2d379ad8a9 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -91,91 +91,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/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/Trino/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 6a63f5fde6..fe72c49a28 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/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/Trino/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -87,4 +87,4 @@ SELECT , is_instant , is_instant AS booking__is_instant , booking_value AS booking_payments -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 1de66ca95f..538f798748 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -103,91 +103,91 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 8d46cda654..40a33f4f7c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -99,4 +99,4 @@ SELECT , booking_value AS discrete_booking_value_p99 , booking_value AS approximate_continuous_booking_value_p99 , booking_value AS approximate_discrete_booking_value_p99 -FROM ***************************.fct_bookings bookings_source_src_10001 +FROM ***************************.fct_bookings bookings_source_src_28001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0.sql index 9c777d341d..e37d2870db 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -327,93 +327,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0_optimized.sql index a44c3893c8..46a71e6b6f 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Trino/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', paid_at) AS metric_time__day , SUM(booking_value) AS booking_payments - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_19 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml index 3c19820738..63b2a8198a 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml @@ -225,271 +225,271 @@ - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml index e12d936dda..5c24614180 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml @@ -252,271 +252,271 @@ - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml index 0e2c2e3631..1d40ff0c74 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml @@ -1,7 +1,7 @@ - + @@ -17,10 +17,10 @@ - + - + @@ -34,953 +34,953 @@ - + - - - + + + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -990,903 +990,903 @@ - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql index a9cf23071e..6401fd0627 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0.sql @@ -129,62 +129,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_10000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_10000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_10000.ds, year) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM time_spine_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC(time_spine_src_0.ds, day) AS ds__day + , DATE_TRUNC(time_spine_src_0.ds, isoweek) AS ds__week + , DATE_TRUNC(time_spine_src_0.ds, month) AS ds__month + , DATE_TRUNC(time_spine_src_0.ds, quarter) AS ds__quarter + , DATE_TRUNC(time_spine_src_0.ds, year) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM time_spine_src_0.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_0.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -241,32 +241,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10009.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC(users_latest_src_10009.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS user__ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql index 4923c91668..5f0364638b 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,17 +2,17 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC(time_spine_src_10000.ds, day) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC(time_spine_src_0.ds, day) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id -WHERE DATE_TRUNC(time_spine_src_10000.ds, day) BETWEEN '2020-01-01' AND '2020-01-03' + listings_latest_src_28005.user_id = users_latest_src_28009.user_id +WHERE DATE_TRUNC(time_spine_src_0.ds, day) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY metric_time__day , listing__is_lux_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql index ab281ca909..83fe7ceea3 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_10000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_10000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_10000.ds, year) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM time_spine_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC(time_spine_src_0.ds, day) AS ds__day + , DATE_TRUNC(time_spine_src_0.ds, isoweek) AS ds__week + , DATE_TRUNC(time_spine_src_0.ds, month) AS ds__month + , DATE_TRUNC(time_spine_src_0.ds, quarter) AS ds__quarter + , DATE_TRUNC(time_spine_src_0.ds, year) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM time_spine_src_0.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_0.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql index 2ef65c0995..001fdea8b2 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC(ds, day) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql index 51cbb2a9f0..12a0866e66 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_10000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_10000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_10000.ds, year) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM time_spine_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC(time_spine_src_0.ds, day) AS ds__day + , DATE_TRUNC(time_spine_src_0.ds, isoweek) AS ds__week + , DATE_TRUNC(time_spine_src_0.ds, month) AS ds__month + , DATE_TRUNC(time_spine_src_0.ds, quarter) AS ds__quarter + , DATE_TRUNC(time_spine_src_0.ds, year) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM time_spine_src_0.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_0.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql index 5f71d2855f..6a486adba0 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC(ds, quarter) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY metric_time__quarter diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql index 2691f8088f..d93dc7e440 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC(time_spine_src_10000.ds, day) AS ds__day - , DATE_TRUNC(time_spine_src_10000.ds, isoweek) AS ds__week - , DATE_TRUNC(time_spine_src_10000.ds, month) AS ds__month - , DATE_TRUNC(time_spine_src_10000.ds, quarter) AS ds__quarter - , DATE_TRUNC(time_spine_src_10000.ds, year) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM time_spine_src_10000.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_10000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC(time_spine_src_0.ds, day) AS ds__day + , DATE_TRUNC(time_spine_src_0.ds, isoweek) AS ds__week + , DATE_TRUNC(time_spine_src_0.ds, month) AS ds__month + , DATE_TRUNC(time_spine_src_0.ds, quarter) AS ds__quarter + , DATE_TRUNC(time_spine_src_0.ds, year) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM time_spine_src_0.ds) = 1, 7, EXTRACT(dayofweek FROM time_spine_src_0.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -180,32 +180,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10009.ds, day) AS ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC(users_latest_src_10009.ds, day) AS user__ds_latest__day - , DATE_TRUNC(users_latest_src_10009.ds, isoweek) AS user__ds_latest__week - , DATE_TRUNC(users_latest_src_10009.ds, month) AS user__ds_latest__month - , DATE_TRUNC(users_latest_src_10009.ds, quarter) AS user__ds_latest__quarter - , DATE_TRUNC(users_latest_src_10009.ds, year) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10009.ds) - 1) AS user__ds_latest__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql index 426f7e1e8b..d18a670826 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/BigQuery/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,16 +1,16 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC(time_spine_src_10000.ds, day) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC(time_spine_src_0.ds, day) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY metric_time__day , listing__is_lux_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0.sql index 8b5bd70d38..0f914702ac 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0.sql @@ -129,62 +129,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -241,32 +241,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0_optimized.sql index 512d044bf2..978d323f8b 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,18 +2,18 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id -WHERE DATE_TRUNC('day', time_spine_src_10000.ds) BETWEEN '2020-01-01' AND '2020-01-03' + listings_latest_src_28005.user_id = users_latest_src_28009.user_id +WHERE DATE_TRUNC('day', time_spine_src_0.ds) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0.sql index 67e4638d34..c1a209db11 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0_optimized.sql index 22b25ea2de..15c6b108f1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('day', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0.sql index 408044b614..989ae2bffb 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0_optimized.sql index c4460d6b10..a2abb72352 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('quarter', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0.sql index 6472a387d3..9afc22ac0e 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -180,32 +180,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0_optimized.sql index a39c8d925c..72d3126272 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Databricks/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,17 +1,17 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql index e5c526164a..c7ee79178d 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql @@ -129,62 +129,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -241,32 +241,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql index 512d044bf2..978d323f8b 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,18 +2,18 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id -WHERE DATE_TRUNC('day', time_spine_src_10000.ds) BETWEEN '2020-01-01' AND '2020-01-03' + listings_latest_src_28005.user_id = users_latest_src_28009.user_id +WHERE DATE_TRUNC('day', time_spine_src_0.ds) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql index 8a9730b41b..99e55bdfbe 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql index 22b25ea2de..15c6b108f1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('day', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql index 4d4df5d6ba..370ac1600e 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql index c4460d6b10..a2abb72352 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('quarter', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql index edbd3e342b..b74351891d 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -180,32 +180,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql index a39c8d925c..72d3126272 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,17 +1,17 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0.sql index e5c526164a..c7ee79178d 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0.sql @@ -129,62 +129,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -241,32 +241,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0_optimized.sql index 512d044bf2..978d323f8b 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,18 +2,18 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id -WHERE DATE_TRUNC('day', time_spine_src_10000.ds) BETWEEN '2020-01-01' AND '2020-01-03' + listings_latest_src_28005.user_id = users_latest_src_28009.user_id +WHERE DATE_TRUNC('day', time_spine_src_0.ds) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0.sql index 8a9730b41b..99e55bdfbe 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0_optimized.sql index 22b25ea2de..15c6b108f1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('day', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0.sql index 4d4df5d6ba..370ac1600e 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0_optimized.sql index c4460d6b10..a2abb72352 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('quarter', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0.sql index edbd3e342b..b74351891d 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -180,32 +180,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(isodow FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0_optimized.sql index a39c8d925c..72d3126272 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Postgres/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,17 +1,17 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0.sql index 76c42f8bf6..b977753e00 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0.sql @@ -129,62 +129,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM time_spine_src_10000.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_10000.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM time_spine_src_0.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_0.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_0.ds) END AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -241,32 +241,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0_optimized.sql index 512d044bf2..978d323f8b 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,18 +2,18 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id -WHERE DATE_TRUNC('day', time_spine_src_10000.ds) BETWEEN '2020-01-01' AND '2020-01-03' + listings_latest_src_28005.user_id = users_latest_src_28009.user_id +WHERE DATE_TRUNC('day', time_spine_src_0.ds) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0.sql index 9d8d77be10..4b891850c0 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM time_spine_src_10000.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_10000.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM time_spine_src_0.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_0.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_0.ds) END AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0_optimized.sql index 22b25ea2de..15c6b108f1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('day', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0.sql index a17acbac27..7baba3bce9 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM time_spine_src_10000.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_10000.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM time_spine_src_0.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_0.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_0.ds) END AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0_optimized.sql index c4460d6b10..a2abb72352 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('quarter', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0.sql index 2c0bc66d15..a1707255e1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM time_spine_src_10000.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_10000.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_10000.ds) END AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM time_spine_src_0.ds) = 0 THEN EXTRACT(dow FROM time_spine_src_0.ds) + 7 ELSE EXTRACT(dow FROM time_spine_src_0.ds) END AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -180,32 +180,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10009.ds) END AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0_optimized.sql index a39c8d925c..72d3126272 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Redshift/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,17 +1,17 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0.sql index 82cfafe620..8f74453b30 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0.sql @@ -129,62 +129,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -241,32 +241,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0_optimized.sql index 512d044bf2..978d323f8b 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,18 +2,18 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id -WHERE DATE_TRUNC('day', time_spine_src_10000.ds) BETWEEN '2020-01-01' AND '2020-01-03' + listings_latest_src_28005.user_id = users_latest_src_28009.user_id +WHERE DATE_TRUNC('day', time_spine_src_0.ds) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0.sql index 3309ddbe7f..4cb966c506 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0_optimized.sql index 22b25ea2de..15c6b108f1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('day', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0.sql index 26e4571e45..475700ea61 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0_optimized.sql index c4460d6b10..a2abb72352 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('quarter', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0.sql index 2f4d950c62..3147a5cdb7 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -180,32 +180,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0_optimized.sql index a39c8d925c..72d3126272 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Snowflake/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,17 +1,17 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0.sql index 083b09e0bc..fa5cb77615 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0.sql @@ -129,62 +129,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -241,32 +241,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0_optimized.sql index 1127337e76..16efe80e80 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,18 +2,18 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id -WHERE DATE_TRUNC('day', time_spine_src_10000.ds) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-03' + listings_latest_src_28005.user_id = users_latest_src_28009.user_id +WHERE DATE_TRUNC('day', time_spine_src_0.ds) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-03' GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0.sql index 29ce5195da..b1c1cbc4d9 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0_optimized.sql index 22b25ea2de..15c6b108f1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('day', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0.sql index b20d81f8eb..d81d111aab 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_0 ) subq_1 GROUP BY diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0_optimized.sql index c4460d6b10..a2abb72352 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_10000 +FROM ***************************.mf_time_spine time_spine_src_0 GROUP BY DATE_TRUNC('quarter', ds) diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0.sql index 8e33c956e2..164e1880f1 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 CROSS JOIN ( -- Pass Only Elements: ['metric_time__day',] @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_10000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_10000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_10000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_10000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_10000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_10000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_10000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_10000.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM time_spine_src_10000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_10000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_10000 + DATE_TRUNC('day', time_spine_src_0.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_0.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_0.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_0.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_0.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_0.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_0.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_0.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_0.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM time_spine_src_0.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_0.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_0 ) subq_1 ) subq_2 ) subq_3 @@ -180,32 +180,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10009.ds) AS ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS ds_latest__extract_doy - , users_latest_src_10009.home_state_latest - , DATE_TRUNC('day', users_latest_src_10009.ds) AS user__ds_latest__day - , DATE_TRUNC('week', users_latest_src_10009.ds) AS user__ds_latest__week - , DATE_TRUNC('month', users_latest_src_10009.ds) AS user__ds_latest__month - , DATE_TRUNC('quarter', users_latest_src_10009.ds) AS user__ds_latest__quarter - , DATE_TRUNC('year', users_latest_src_10009.ds) AS user__ds_latest__year - , EXTRACT(year FROM users_latest_src_10009.ds) AS user__ds_latest__extract_year - , EXTRACT(quarter FROM users_latest_src_10009.ds) AS user__ds_latest__extract_quarter - , EXTRACT(month FROM users_latest_src_10009.ds) AS user__ds_latest__extract_month - , EXTRACT(day FROM users_latest_src_10009.ds) AS user__ds_latest__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10009.ds) AS user__ds_latest__extract_dow - , EXTRACT(doy FROM users_latest_src_10009.ds) AS user__ds_latest__extract_doy - , users_latest_src_10009.home_state_latest AS user__home_state_latest - , users_latest_src_10009.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10009 + DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy + , users_latest_src_28009.home_state_latest + , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month + , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy + , users_latest_src_28009.home_state_latest AS user__home_state_latest + , users_latest_src_28009.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_28009 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0_optimized.sql index a39c8d925c..72d3126272 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/Trino/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,17 +1,17 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_10000.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , users_latest_src_10009.home_state_latest AS user__home_state_latest -FROM ***************************.dim_listings_latest listings_latest_src_10005 + DATE_TRUNC('day', time_spine_src_0.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , users_latest_src_28009.home_state_latest AS user__home_state_latest +FROM ***************************.dim_listings_latest listings_latest_src_28005 CROSS JOIN - ***************************.mf_time_spine time_spine_src_10000 + ***************************.mf_time_spine time_spine_src_0 FULL OUTER JOIN - ***************************.dim_users_latest users_latest_src_10009 + ***************************.dim_users_latest users_latest_src_28009 ON - listings_latest_src_10005.user_id = users_latest_src_10009.user_id + listings_latest_src_28005.user_id = users_latest_src_28009.user_id GROUP BY - DATE_TRUNC('day', time_spine_src_10000.ds) - , listings_latest_src_10005.is_lux - , users_latest_src_10009.home_state_latest + DATE_TRUNC('day', time_spine_src_0.ds) + , listings_latest_src_28005.is_lux + , users_latest_src_28009.home_state_latest diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml index 4cbe163f3d..ad143eb1a6 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml @@ -2,443 +2,443 @@ - - + + - + - - + + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - - + + - - - - + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - - - + + + - + - + - + - + - + - + - - + + - + - + @@ -447,414 +447,408 @@ - + - + - + - + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -862,147 +856,147 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml index 2d4903f90c..3c1a62ef6c 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml @@ -1,100 +1,96 @@ - - - + + + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml index 2e75d5e330..c9fdfbaa40 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml @@ -1,101 +1,97 @@ - + - - + + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + diff --git a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml index 4cfcf08db3..cfc768f43c 100644 --- a/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml @@ -2,222 +2,222 @@ - - + + - + - - + + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + + + + + + - + - - - + + + - + - - + + - + - + - + - + - + - + - + - - + + - + - + @@ -226,367 +226,348 @@ - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + @@ -594,132 +575,132 @@ - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql index 361166f2b7..8c92f3919c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -339,93 +339,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql index 7320ee2651..3fa4fb3aa6 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day ) subq_19 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql index 22fc80abd1..56d1966a90 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 WHERE listing__country_latest = 'us' ) subq_1 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0_optimized.sql index 7d0117953d..22b719da85 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql index b29099e6ed..b99d711af8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -143,93 +143,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -312,62 +312,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql index 0dbe3c135e..fdbb61ce0e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing__country_latest'] SELECT subq_13.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,12 +20,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_13.listing = listings_latest_src_10005.listing_id + subq_13.listing = listings_latest_src_28005.listing_id ) subq_18 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql index 446f70c33f..4c230ae33f 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql @@ -139,87 +139,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC(bookings_source_src_10017.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_10017.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_10017.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_10017.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_10017.ds, year) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10017.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_10017.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_10017.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_10017.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_10017.paid_at, year) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) - 1) AS paid_at__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_10017.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_10017.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_10017.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_10017.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_10017.ds, year) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, year) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10017.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_10017.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_10017.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_10017.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_10017.paid_at, year) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) - 1) AS booking__paid_at__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC(bookings_source_src_26000.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_26000.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_26000.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -233,60 +233,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC(listings_src_10019.active_from, isoweek) AS window_start__week - , DATE_TRUNC(listings_src_10019.active_from, month) AS window_start__month - , DATE_TRUNC(listings_src_10019.active_from, quarter) AS window_start__quarter - , DATE_TRUNC(listings_src_10019.active_from, year) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_from) - 1) AS window_start__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC(listings_src_10019.active_to, isoweek) AS window_end__week - , DATE_TRUNC(listings_src_10019.active_to, month) AS window_end__month - , DATE_TRUNC(listings_src_10019.active_to, quarter) AS window_end__quarter - , DATE_TRUNC(listings_src_10019.active_to, year) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_to) - 1) AS window_end__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC(listings_src_10019.active_from, isoweek) AS listing__window_start__week - , DATE_TRUNC(listings_src_10019.active_from, month) AS listing__window_start__month - , DATE_TRUNC(listings_src_10019.active_from, quarter) AS listing__window_start__quarter - , DATE_TRUNC(listings_src_10019.active_from, year) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_from) - 1) AS listing__window_start__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC(listings_src_10019.active_to, isoweek) AS listing__window_end__week - , DATE_TRUNC(listings_src_10019.active_to, month) AS listing__window_end__month - , DATE_TRUNC(listings_src_10019.active_to, quarter) AS listing__window_end__quarter - , DATE_TRUNC(listings_src_10019.active_to, year) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_to) - 1) AS listing__window_end__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC(listings_src_26002.active_from, isoweek) AS window_start__week + , DATE_TRUNC(listings_src_26002.active_from, month) AS window_start__month + , DATE_TRUNC(listings_src_26002.active_from, quarter) AS window_start__quarter + , DATE_TRUNC(listings_src_26002.active_from, year) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_from) - 1) AS window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC(listings_src_26002.active_to, isoweek) AS window_end__week + , DATE_TRUNC(listings_src_26002.active_to, month) AS window_end__month + , DATE_TRUNC(listings_src_26002.active_to, quarter) AS window_end__quarter + , DATE_TRUNC(listings_src_26002.active_to, year) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_to) - 1) AS window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC(listings_src_26002.active_from, isoweek) AS listing__window_start__week + , DATE_TRUNC(listings_src_26002.active_from, month) AS listing__window_start__month + , DATE_TRUNC(listings_src_26002.active_from, quarter) AS listing__window_start__quarter + , DATE_TRUNC(listings_src_26002.active_from, year) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_from) - 1) AS listing__window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC(listings_src_26002.active_to, isoweek) AS listing__window_end__week + , DATE_TRUNC(listings_src_26002.active_to, month) AS listing__window_end__month + , DATE_TRUNC(listings_src_26002.active_to, quarter) AS listing__window_end__quarter + , DATE_TRUNC(listings_src_26002.active_to, year) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_to) - 1) AS listing__window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql index 4c041caceb..ce73eff7d1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__capacity', 'metric_time__day'] SELECT subq_12.metric_time__day AS metric_time__day - , listings_src_10019.capacity AS listing__capacity + , listings_src_26002.capacity AS listing__capacity , subq_12.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,21 +20,21 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_12 LEFT OUTER JOIN - ***************************.dim_listings listings_src_10019 + ***************************.dim_listings listings_src_26002 ON ( - subq_12.listing = listings_src_10019.listing_id + subq_12.listing = listings_src_26002.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10019.active_from + subq_12.metric_time__day >= listings_src_26002.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10019.active_to + subq_12.metric_time__day < listings_src_26002.active_to ) OR ( - listings_src_10019.active_to IS NULL + listings_src_26002.active_to IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql index 6dcd625328..f4431e9d9f 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql @@ -123,93 +123,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql index d1389fc92e..939d96354f 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql index a1bd1a33a8..b3c6c96ff2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql @@ -86,62 +86,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0_optimized.sql index 557dd4d7a1..8486e86449 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT country AS listing__country_latest , 1 AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql index 9d91ca92e6..3f622f3979 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql @@ -155,93 +155,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -324,62 +324,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -540,93 +540,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -709,62 +709,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -902,93 +902,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql index 1a595f1f8e..afb361b267 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0_optimized.sql @@ -21,14 +21,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC(bookings_source_src_10001.ds, day) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + DATE_TRUNC(bookings_source_src_28001.ds, day) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_37 WHERE listing__is_lux_latest GROUP BY @@ -47,7 +47,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'metric_time__day'] SELECT subq_44.metric_time__day AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_44.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -57,12 +57,12 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_44 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_44.listing = listings_latest_src_10005.listing_id + subq_44.listing = listings_latest_src_28005.listing_id ) subq_49 WHERE listing__is_lux_latest GROUP BY @@ -79,7 +79,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day ) subq_58 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql index 88e99c208e..2ef25fcc8b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -359,93 +359,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql index a2d32c0c71..1b73aecc3e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 WHERE booking__is_instant GROUP BY @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY metric_time__day ) subq_24 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql index e61ec8479f..26ea88f8a2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -135,93 +135,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 633bf4ddc0..315465981a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 WHERE NOT booking__is_instant GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 9d2e0d9271..3e678aca18 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -302,62 +302,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql index 74953c13c8..e711c1aa00 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -20,5 +20,5 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_20 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql index 59aa26735d..d626d79921 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0.sql @@ -10,62 +10,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0_optimized.sql index b5d9bc2af4..4f2c89fad9 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_categorical__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['listing__country_latest',] SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 GROUP BY listing__country_latest ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql index 89bbca7504..e807808c9b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY booking__paid_at__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql index 0f1475ba79..248c95268a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__day',] SELECT DATE_TRUNC(paid_at, day) AS booking__paid_at__day - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY booking__paid_at__day ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql index 67cfa814a1..cf955fce66 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY booking__paid_at__quarter diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql index 1e1b55e704..86016c5223 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_min_max_only_time_quarter__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY booking__paid_at__quarter ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql index 7a09be076b..0c04d7784a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC(bookings_source_src_10017.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_10017.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_10017.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_10017.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_10017.ds, year) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10017.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_10017.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_10017.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_10017.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_10017.paid_at, year) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) - 1) AS paid_at__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_10017.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_10017.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_10017.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_10017.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_10017.ds, year) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, year) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10017.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_10017.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_10017.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_10017.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_10017.paid_at, year) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) - 1) AS booking__paid_at__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC(bookings_source_src_26000.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_26000.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_26000.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -292,60 +292,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC(listings_src_10019.active_from, isoweek) AS window_start__week - , DATE_TRUNC(listings_src_10019.active_from, month) AS window_start__month - , DATE_TRUNC(listings_src_10019.active_from, quarter) AS window_start__quarter - , DATE_TRUNC(listings_src_10019.active_from, year) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_from) - 1) AS window_start__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC(listings_src_10019.active_to, isoweek) AS window_end__week - , DATE_TRUNC(listings_src_10019.active_to, month) AS window_end__month - , DATE_TRUNC(listings_src_10019.active_to, quarter) AS window_end__quarter - , DATE_TRUNC(listings_src_10019.active_to, year) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_to) - 1) AS window_end__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC(listings_src_10019.active_from, isoweek) AS listing__window_start__week - , DATE_TRUNC(listings_src_10019.active_from, month) AS listing__window_start__month - , DATE_TRUNC(listings_src_10019.active_from, quarter) AS listing__window_start__quarter - , DATE_TRUNC(listings_src_10019.active_from, year) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_from) - 1) AS listing__window_start__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC(listings_src_10019.active_to, isoweek) AS listing__window_end__week - , DATE_TRUNC(listings_src_10019.active_to, month) AS listing__window_end__month - , DATE_TRUNC(listings_src_10019.active_to, quarter) AS listing__window_end__quarter - , DATE_TRUNC(listings_src_10019.active_to, year) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , IF(EXTRACT(dayofweek FROM listings_src_10019.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_10019.active_to) - 1) AS listing__window_end__extract_dow - , EXTRACT(dayofyear FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC(listings_src_26002.active_from, isoweek) AS window_start__week + , DATE_TRUNC(listings_src_26002.active_from, month) AS window_start__month + , DATE_TRUNC(listings_src_26002.active_from, quarter) AS window_start__quarter + , DATE_TRUNC(listings_src_26002.active_from, year) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_from) - 1) AS window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC(listings_src_26002.active_to, isoweek) AS window_end__week + , DATE_TRUNC(listings_src_26002.active_to, month) AS window_end__month + , DATE_TRUNC(listings_src_26002.active_to, quarter) AS window_end__quarter + , DATE_TRUNC(listings_src_26002.active_to, year) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_to) - 1) AS window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC(listings_src_26002.active_from, isoweek) AS listing__window_start__week + , DATE_TRUNC(listings_src_26002.active_from, month) AS listing__window_start__month + , DATE_TRUNC(listings_src_26002.active_from, quarter) AS listing__window_start__quarter + , DATE_TRUNC(listings_src_26002.active_from, year) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_from) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_from) - 1) AS listing__window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC(listings_src_26002.active_to, isoweek) AS listing__window_end__week + , DATE_TRUNC(listings_src_26002.active_to, month) AS listing__window_end__month + , DATE_TRUNC(listings_src_26002.active_to, quarter) AS listing__window_end__quarter + , DATE_TRUNC(listings_src_26002.active_to, year) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , IF(EXTRACT(dayofweek FROM listings_src_26002.active_to) = 1, 7, EXTRACT(dayofweek FROM listings_src_26002.active_to) - 1) AS listing__window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -404,32 +404,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC(users_latest_src_10023.ds, day) AS ds__day - , DATE_TRUNC(users_latest_src_10023.ds, isoweek) AS ds__week - , DATE_TRUNC(users_latest_src_10023.ds, month) AS ds__month - , DATE_TRUNC(users_latest_src_10023.ds, quarter) AS ds__quarter - , DATE_TRUNC(users_latest_src_10023.ds, year) AS ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10023.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10023.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10023.ds) AS ds__extract_doy - , users_latest_src_10023.home_state_latest - , DATE_TRUNC(users_latest_src_10023.ds, day) AS user__ds__day - , DATE_TRUNC(users_latest_src_10023.ds, isoweek) AS user__ds__week - , DATE_TRUNC(users_latest_src_10023.ds, month) AS user__ds__month - , DATE_TRUNC(users_latest_src_10023.ds, quarter) AS user__ds__quarter - , DATE_TRUNC(users_latest_src_10023.ds, year) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS user__ds__extract_day - , IF(EXTRACT(dayofweek FROM users_latest_src_10023.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_10023.ds) - 1) AS user__ds__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10023.ds) AS user__ds__extract_doy - , users_latest_src_10023.home_state_latest AS user__home_state_latest - , users_latest_src_10023.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10023 + DATE_TRUNC(users_latest_src_26006.ds, day) AS ds__day + , DATE_TRUNC(users_latest_src_26006.ds, isoweek) AS ds__week + , DATE_TRUNC(users_latest_src_26006.ds, month) AS ds__month + , DATE_TRUNC(users_latest_src_26006.ds, quarter) AS ds__quarter + , DATE_TRUNC(users_latest_src_26006.ds, year) AS ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_26006.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_26006.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_26006.ds) AS ds__extract_doy + , users_latest_src_26006.home_state_latest + , DATE_TRUNC(users_latest_src_26006.ds, day) AS user__ds__day + , DATE_TRUNC(users_latest_src_26006.ds, isoweek) AS user__ds__week + , DATE_TRUNC(users_latest_src_26006.ds, month) AS user__ds__month + , DATE_TRUNC(users_latest_src_26006.ds, quarter) AS user__ds__quarter + , DATE_TRUNC(users_latest_src_26006.ds, year) AS user__ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS user__ds__extract_day + , IF(EXTRACT(dayofweek FROM users_latest_src_26006.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_26006.ds) - 1) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_26006.ds) AS user__ds__extract_doy + , users_latest_src_26006.home_state_latest AS user__home_state_latest + , users_latest_src_26006.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_26006 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql index fd53a5abff..6a2a62a0a4 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10019.active_from AS window_start__day - , listings_src_10019.active_to AS window_end__day - , listings_src_10019.listing_id AS listing - , users_latest_src_10023.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , listings_src_26002.active_to AS window_end__day + , listings_src_26002.listing_id AS listing + , users_latest_src_26006.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings listings_src_26002 LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_10023 + ***************************.dim_users_latest users_latest_src_26006 ON - listings_src_10019.user_id = users_latest_src_10023.user_id + listings_src_26002.user_id = users_latest_src_26006.user_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql index 08e6a6e80c..9577af0b81 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC(bookings_source_src_10017.ds, day) AS ds__day - , DATE_TRUNC(bookings_source_src_10017.ds, isoweek) AS ds__week - , DATE_TRUNC(bookings_source_src_10017.ds, month) AS ds__month - , DATE_TRUNC(bookings_source_src_10017.ds, quarter) AS ds__quarter - , DATE_TRUNC(bookings_source_src_10017.ds, year) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10017.paid_at, day) AS paid_at__day - , DATE_TRUNC(bookings_source_src_10017.paid_at, isoweek) AS paid_at__week - , DATE_TRUNC(bookings_source_src_10017.paid_at, month) AS paid_at__month - , DATE_TRUNC(bookings_source_src_10017.paid_at, quarter) AS paid_at__quarter - , DATE_TRUNC(bookings_source_src_10017.paid_at, year) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) - 1) AS paid_at__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC(bookings_source_src_10017.ds, day) AS booking__ds__day - , DATE_TRUNC(bookings_source_src_10017.ds, isoweek) AS booking__ds__week - , DATE_TRUNC(bookings_source_src_10017.ds, month) AS booking__ds__month - , DATE_TRUNC(bookings_source_src_10017.ds, quarter) AS booking__ds__quarter - , DATE_TRUNC(bookings_source_src_10017.ds, year) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, day) AS booking__ds_partitioned__day - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, isoweek) AS booking__ds_partitioned__week - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, month) AS booking__ds_partitioned__month - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, quarter) AS booking__ds_partitioned__quarter - , DATE_TRUNC(bookings_source_src_10017.ds_partitioned, year) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10017.paid_at, day) AS booking__paid_at__day - , DATE_TRUNC(bookings_source_src_10017.paid_at, isoweek) AS booking__paid_at__week - , DATE_TRUNC(bookings_source_src_10017.paid_at, month) AS booking__paid_at__month - , DATE_TRUNC(bookings_source_src_10017.paid_at, quarter) AS booking__paid_at__quarter - , DATE_TRUNC(bookings_source_src_10017.paid_at, year) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10017.paid_at) - 1) AS booking__paid_at__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC(bookings_source_src_26000.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_26000.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_26000.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_26000.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_26000.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_26000.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_26000.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_26000.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_26000.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_26000.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_26000.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_26000.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_26000.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_26000.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_26000.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -253,10 +253,10 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT - lux_listing_mapping_src_10020.listing_id AS listing - , lux_listing_mapping_src_10020.lux_listing_id AS lux_listing - , lux_listing_mapping_src_10020.lux_listing_id AS listing__lux_listing - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listing_mapping_src_26003.listing_id AS listing + , lux_listing_mapping_src_26003.lux_listing_id AS lux_listing + , lux_listing_mapping_src_26003.lux_listing_id AS listing__lux_listing + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -359,54 +359,54 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT - lux_listings_src_10021.valid_from AS window_start__day - , DATE_TRUNC(lux_listings_src_10021.valid_from, isoweek) AS window_start__week - , DATE_TRUNC(lux_listings_src_10021.valid_from, month) AS window_start__month - , DATE_TRUNC(lux_listings_src_10021.valid_from, quarter) AS window_start__quarter - , DATE_TRUNC(lux_listings_src_10021.valid_from, year) AS window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS window_start__extract_day - , IF(EXTRACT(dayofweek FROM lux_listings_src_10021.valid_from) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_10021.valid_from) - 1) AS window_start__extract_dow - , EXTRACT(dayofyear FROM lux_listings_src_10021.valid_from) AS window_start__extract_doy - , lux_listings_src_10021.valid_to AS window_end__day - , DATE_TRUNC(lux_listings_src_10021.valid_to, isoweek) AS window_end__week - , DATE_TRUNC(lux_listings_src_10021.valid_to, month) AS window_end__month - , DATE_TRUNC(lux_listings_src_10021.valid_to, quarter) AS window_end__quarter - , DATE_TRUNC(lux_listings_src_10021.valid_to, year) AS window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS window_end__extract_day - , IF(EXTRACT(dayofweek FROM lux_listings_src_10021.valid_to) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_10021.valid_to) - 1) AS window_end__extract_dow - , EXTRACT(dayofyear FROM lux_listings_src_10021.valid_to) AS window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux - , lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , DATE_TRUNC(lux_listings_src_10021.valid_from, isoweek) AS lux_listing__window_start__week - , DATE_TRUNC(lux_listings_src_10021.valid_from, month) AS lux_listing__window_start__month - , DATE_TRUNC(lux_listings_src_10021.valid_from, quarter) AS lux_listing__window_start__quarter - , DATE_TRUNC(lux_listings_src_10021.valid_from, year) AS lux_listing__window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_day - , IF(EXTRACT(dayofweek FROM lux_listings_src_10021.valid_from) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_10021.valid_from) - 1) AS lux_listing__window_start__extract_dow - , EXTRACT(dayofyear FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_doy - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , DATE_TRUNC(lux_listings_src_10021.valid_to, isoweek) AS lux_listing__window_end__week - , DATE_TRUNC(lux_listings_src_10021.valid_to, month) AS lux_listing__window_end__month - , DATE_TRUNC(lux_listings_src_10021.valid_to, quarter) AS lux_listing__window_end__quarter - , DATE_TRUNC(lux_listings_src_10021.valid_to, year) AS lux_listing__window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_day - , IF(EXTRACT(dayofweek FROM lux_listings_src_10021.valid_to) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_10021.valid_to) - 1) AS lux_listing__window_end__extract_dow - , EXTRACT(dayofyear FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - , lux_listings_src_10021.lux_listing_id AS lux_listing - FROM ***************************.dim_lux_listings lux_listings_src_10021 + lux_listings_src_26004.valid_from AS window_start__day + , DATE_TRUNC(lux_listings_src_26004.valid_from, isoweek) AS window_start__week + , DATE_TRUNC(lux_listings_src_26004.valid_from, month) AS window_start__month + , DATE_TRUNC(lux_listings_src_26004.valid_from, quarter) AS window_start__quarter + , DATE_TRUNC(lux_listings_src_26004.valid_from, year) AS window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS window_start__extract_day + , IF(EXTRACT(dayofweek FROM lux_listings_src_26004.valid_from) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_26004.valid_from) - 1) AS window_start__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_26004.valid_from) AS window_start__extract_doy + , lux_listings_src_26004.valid_to AS window_end__day + , DATE_TRUNC(lux_listings_src_26004.valid_to, isoweek) AS window_end__week + , DATE_TRUNC(lux_listings_src_26004.valid_to, month) AS window_end__month + , DATE_TRUNC(lux_listings_src_26004.valid_to, quarter) AS window_end__quarter + , DATE_TRUNC(lux_listings_src_26004.valid_to, year) AS window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS window_end__extract_day + , IF(EXTRACT(dayofweek FROM lux_listings_src_26004.valid_to) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_26004.valid_to) - 1) AS window_end__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_26004.valid_to) AS window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux + , lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , DATE_TRUNC(lux_listings_src_26004.valid_from, isoweek) AS lux_listing__window_start__week + , DATE_TRUNC(lux_listings_src_26004.valid_from, month) AS lux_listing__window_start__month + , DATE_TRUNC(lux_listings_src_26004.valid_from, quarter) AS lux_listing__window_start__quarter + , DATE_TRUNC(lux_listings_src_26004.valid_from, year) AS lux_listing__window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_day + , IF(EXTRACT(dayofweek FROM lux_listings_src_26004.valid_from) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_26004.valid_from) - 1) AS lux_listing__window_start__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_doy + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , DATE_TRUNC(lux_listings_src_26004.valid_to, isoweek) AS lux_listing__window_end__week + , DATE_TRUNC(lux_listings_src_26004.valid_to, month) AS lux_listing__window_end__month + , DATE_TRUNC(lux_listings_src_26004.valid_to, quarter) AS lux_listing__window_end__quarter + , DATE_TRUNC(lux_listings_src_26004.valid_to, year) AS lux_listing__window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_day + , IF(EXTRACT(dayofweek FROM lux_listings_src_26004.valid_to) = 1, 7, EXTRACT(dayofweek FROM lux_listings_src_26004.valid_to) - 1) AS lux_listing__window_end__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + , lux_listings_src_26004.lux_listing_id AS lux_listing + FROM ***************************.dim_lux_listings lux_listings_src_26004 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql index 8c6cc5ded3..35253e96cb 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['lux_listing__is_confirmed_lux', 'lux_listing__window_start__day', 'lux_listing__window_end__day', 'listing'] SELECT - lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , lux_listing_mapping_src_10020.listing_id AS listing - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , lux_listing_mapping_src_26003.listing_id AS listing + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 LEFT OUTER JOIN - ***************************.dim_lux_listings lux_listings_src_10021 + ***************************.dim_lux_listings lux_listings_src_26004 ON - lux_listing_mapping_src_10020.lux_listing_id = lux_listings_src_10021.lux_listing_id + lux_listing_mapping_src_26003.lux_listing_id = lux_listings_src_26004.lux_listing_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql index 4bde21047d..922b372419 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql @@ -91,55 +91,55 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT - account_month_txns_src_10012.txn_count - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM account_month_txns_src_10012.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_10012.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(account_month_txns_src_10012.ds, day) AS ds__day - , DATE_TRUNC(account_month_txns_src_10012.ds, isoweek) AS ds__week - , DATE_TRUNC(account_month_txns_src_10012.ds, month) AS ds__month - , DATE_TRUNC(account_month_txns_src_10012.ds, quarter) AS ds__quarter - , DATE_TRUNC(account_month_txns_src_10012.ds, year) AS ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM account_month_txns_src_10012.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_10012.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM account_month_txns_src_10012.ds) AS ds__extract_doy - , account_month_txns_src_10012.account_month - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, day) AS account_id__ds_partitioned__day - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, isoweek) AS account_id__ds_partitioned__week - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, month) AS account_id__ds_partitioned__month - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter - , DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, year) AS account_id__ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM account_month_txns_src_10012.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_10012.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC(account_month_txns_src_10012.ds, day) AS account_id__ds__day - , DATE_TRUNC(account_month_txns_src_10012.ds, isoweek) AS account_id__ds__week - , DATE_TRUNC(account_month_txns_src_10012.ds, month) AS account_id__ds__month - , DATE_TRUNC(account_month_txns_src_10012.ds, quarter) AS account_id__ds__quarter - , DATE_TRUNC(account_month_txns_src_10012.ds, year) AS account_id__ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_day - , IF(EXTRACT(dayofweek FROM account_month_txns_src_10012.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_10012.ds) - 1) AS account_id__ds__extract_dow - , EXTRACT(dayofyear FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_doy - , account_month_txns_src_10012.account_month AS account_id__account_month - , account_month_txns_src_10012.account_id - FROM ***************************.account_month_txns account_month_txns_src_10012 + account_month_txns_src_22000.txn_count + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS ds__day + , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS ds__week + , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS ds__month + , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS ds__quarter + , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds) AS ds__extract_doy + , account_month_txns_src_22000.account_month + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter + , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS account_id__ds__day + , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS account_id__ds__week + , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS account_id__ds__month + , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS account_id__ds__quarter + , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS account_id__ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day + , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) - 1) AS account_id__ds__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy + , account_month_txns_src_22000.account_month AS account_id__account_month + , account_month_txns_src_22000.account_id + FROM ***************************.account_month_txns account_month_txns_src_22000 ) subq_0 ) subq_1 ) subq_2 @@ -209,48 +209,48 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bridge_table' SELECT - bridge_table_src_10013.extra_dim - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bridge_table_src_10013.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_10013.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS account_id__extra_dim - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, day) AS account_id__ds_partitioned__day - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, isoweek) AS account_id__ds_partitioned__week - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, month) AS account_id__ds_partitioned__month - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, year) AS account_id__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bridge_table_src_10013.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_10013.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, day) AS bridge_account__ds_partitioned__day - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, month) AS bridge_account__ds_partitioned__month - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC(bridge_table_src_10013.ds_partitioned, year) AS bridge_account__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bridge_table_src_10013.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_10013.ds_partitioned) - 1) AS bridge_account__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy - , bridge_table_src_10013.account_id - , bridge_table_src_10013.customer_id - , bridge_table_src_10013.customer_id AS account_id__customer_id - , bridge_table_src_10013.account_id AS bridge_account__account_id - , bridge_table_src_10013.customer_id AS bridge_account__customer_id - FROM ***************************.bridge_table bridge_table_src_10013 + bridge_table_src_22001.extra_dim + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bridge_table_src_22001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS account_id__extra_dim + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, day) AS account_id__ds_partitioned__day + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, isoweek) AS account_id__ds_partitioned__week + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, month) AS account_id__ds_partitioned__month + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, year) AS account_id__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bridge_table_src_22001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22001.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS bridge_account__extra_dim + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, day) AS bridge_account__ds_partitioned__day + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, month) AS bridge_account__ds_partitioned__month + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC(bridge_table_src_22001.ds_partitioned, year) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bridge_table_src_22001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22001.ds_partitioned) - 1) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy + , bridge_table_src_22001.account_id + , bridge_table_src_22001.customer_id + , bridge_table_src_22001.customer_id AS account_id__customer_id + , bridge_table_src_22001.account_id AS bridge_account__account_id + , bridge_table_src_22001.customer_id AS bridge_account__customer_id + FROM ***************************.bridge_table bridge_table_src_22001 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -313,34 +313,34 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_table' SELECT - customer_table_src_10015.customer_name - , customer_table_src_10015.customer_atomic_weight - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM customer_table_src_10015.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_10015.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_doy - , customer_table_src_10015.customer_name AS customer_id__customer_name - , customer_table_src_10015.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, day) AS customer_id__ds_partitioned__day - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, isoweek) AS customer_id__ds_partitioned__week - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, month) AS customer_id__ds_partitioned__month - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, quarter) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC(customer_table_src_10015.ds_partitioned, year) AS customer_id__ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM customer_table_src_10015.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_10015.ds_partitioned) - 1) AS customer_id__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_doy - , customer_table_src_10015.customer_id - FROM ***************************.customer_table customer_table_src_10015 + customer_table_src_22003.customer_name + , customer_table_src_22003.customer_atomic_weight + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM customer_table_src_22003.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_22003.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_doy + , customer_table_src_22003.customer_name AS customer_id__customer_name + , customer_table_src_22003.customer_atomic_weight AS customer_id__customer_atomic_weight + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, day) AS customer_id__ds_partitioned__day + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, isoweek) AS customer_id__ds_partitioned__week + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, month) AS customer_id__ds_partitioned__month + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, quarter) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC(customer_table_src_22003.ds_partitioned, year) AS customer_id__ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM customer_table_src_22003.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_22003.ds_partitioned) - 1) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , customer_table_src_22003.customer_id + FROM ***************************.customer_table customer_table_src_22003 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql index 23e08edb5c..57fc955213 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql @@ -4,30 +4,30 @@ -- Compute Metrics via Expressions SELECT subq_18.customer_id__customer_name AS account_id__customer_id__customer_name - , SUM(account_month_txns_src_10012.txn_count) AS txn_count -FROM ***************************.account_month_txns account_month_txns_src_10012 + , SUM(account_month_txns_src_22000.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_22000 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC(bridge_table_src_10013.ds_partitioned, day) AS ds_partitioned__day - , bridge_table_src_10013.account_id AS account_id - , customer_table_src_10015.customer_name AS customer_id__customer_name - FROM ***************************.bridge_table bridge_table_src_10013 + DATE_TRUNC(bridge_table_src_22001.ds_partitioned, day) AS ds_partitioned__day + , bridge_table_src_22001.account_id AS account_id + , customer_table_src_22003.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_22001 LEFT OUTER JOIN - ***************************.customer_table customer_table_src_10015 + ***************************.customer_table customer_table_src_22003 ON ( - bridge_table_src_10013.customer_id = customer_table_src_10015.customer_id + bridge_table_src_22001.customer_id = customer_table_src_22003.customer_id ) AND ( - DATE_TRUNC(bridge_table_src_10013.ds_partitioned, day) = DATE_TRUNC(customer_table_src_10015.ds_partitioned, day) + DATE_TRUNC(bridge_table_src_22001.ds_partitioned, day) = DATE_TRUNC(customer_table_src_22003.ds_partitioned, day) ) ) subq_18 ON ( - account_month_txns_src_10012.account_id = subq_18.account_id + account_month_txns_src_22000.account_id = subq_18.account_id ) AND ( - DATE_TRUNC(account_month_txns_src_10012.ds_partitioned, day) = subq_18.ds_partitioned__day + DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_18.ds_partitioned__day ) GROUP BY account_id__customer_id__customer_name diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql index 613b99e900..c22b96260b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' @@ -471,62 +471,62 @@ CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__ds__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__ds__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__ds__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__ds__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__ds__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC(listings_latest_src_10005.created_at, day) AS listing__created_at__day - , DATE_TRUNC(listings_latest_src_10005.created_at, isoweek) AS listing__created_at__week - , DATE_TRUNC(listings_latest_src_10005.created_at, month) AS listing__created_at__month - , DATE_TRUNC(listings_latest_src_10005.created_at, quarter) AS listing__created_at__quarter - , DATE_TRUNC(listings_latest_src_10005.created_at, year) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , IF(EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_10005.created_at) - 1) AS listing__created_at__extract_dow - , EXTRACT(dayofyear FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day + , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week + , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month + , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter + , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 ) subq_7 WHERE subq_7.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql index ef1a3de68b..2c8f47874d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_17 CROSS JOIN ( @@ -23,6 +23,6 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 WHERE DATE_TRUNC(created_at, day) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_23 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql index 6457206ba4..0c355fc5a3 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql @@ -94,56 +94,56 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC(id_verifications_src_10004.ds, day) AS ds__day - , DATE_TRUNC(id_verifications_src_10004.ds, isoweek) AS ds__week - , DATE_TRUNC(id_verifications_src_10004.ds, month) AS ds__month - , DATE_TRUNC(id_verifications_src_10004.ds, quarter) AS ds__quarter - , DATE_TRUNC(id_verifications_src_10004.ds, year) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC(id_verifications_src_10004.ds, day) AS verification__ds__day - , DATE_TRUNC(id_verifications_src_10004.ds, isoweek) AS verification__ds__week - , DATE_TRUNC(id_verifications_src_10004.ds, month) AS verification__ds__month - , DATE_TRUNC(id_verifications_src_10004.ds, quarter) AS verification__ds__quarter - , DATE_TRUNC(id_verifications_src_10004.ds, year) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds) - 1) AS verification__ds__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, day) AS verification__ds_partitioned__day - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, isoweek) AS verification__ds_partitioned__week - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, month) AS verification__ds_partitioned__month - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, quarter) AS verification__ds_partitioned__quarter - , DATE_TRUNC(id_verifications_src_10004.ds_partitioned, year) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_10004.ds_partitioned) - 1) AS verification__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user - FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC(id_verifications_src_28004.ds, day) AS ds__day + , DATE_TRUNC(id_verifications_src_28004.ds, isoweek) AS ds__week + , DATE_TRUNC(id_verifications_src_28004.ds, month) AS ds__month + , DATE_TRUNC(id_verifications_src_28004.ds, quarter) AS ds__quarter + , DATE_TRUNC(id_verifications_src_28004.ds, year) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC(id_verifications_src_28004.ds, day) AS verification__ds__day + , DATE_TRUNC(id_verifications_src_28004.ds, isoweek) AS verification__ds__week + , DATE_TRUNC(id_verifications_src_28004.ds, month) AS verification__ds__month + , DATE_TRUNC(id_verifications_src_28004.ds, quarter) AS verification__ds__quarter + , DATE_TRUNC(id_verifications_src_28004.ds, year) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds) - 1) AS verification__ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, day) AS verification__ds_partitioned__day + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, isoweek) AS verification__ds_partitioned__week + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, month) AS verification__ds_partitioned__month + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, quarter) AS verification__ds_partitioned__quarter + , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, year) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) - 1) AS verification__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_0 ) subq_1 ) subq_2 @@ -156,76 +156,76 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC(users_ds_source_src_10008.ds, day) AS ds__day - , DATE_TRUNC(users_ds_source_src_10008.ds, isoweek) AS ds__week - , DATE_TRUNC(users_ds_source_src_10008.ds, month) AS ds__month - , DATE_TRUNC(users_ds_source_src_10008.ds, quarter) AS ds__quarter - , DATE_TRUNC(users_ds_source_src_10008.ds, year) AS ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM users_ds_source_src_10008.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_10008.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_10008.ds) AS ds__extract_doy - , DATE_TRUNC(users_ds_source_src_10008.created_at, day) AS created_at__day - , DATE_TRUNC(users_ds_source_src_10008.created_at, isoweek) AS created_at__week - , DATE_TRUNC(users_ds_source_src_10008.created_at, month) AS created_at__month - , DATE_TRUNC(users_ds_source_src_10008.created_at, quarter) AS created_at__quarter - , DATE_TRUNC(users_ds_source_src_10008.created_at, year) AS created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS created_at__extract_day - , IF(EXTRACT(dayofweek FROM users_ds_source_src_10008.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_10008.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_10008.created_at) AS created_at__extract_doy - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, day) AS ds_partitioned__day - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, isoweek) AS ds_partitioned__week - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, month) AS ds_partitioned__month - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, year) AS ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM users_ds_source_src_10008.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_10008.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state - , DATE_TRUNC(users_ds_source_src_10008.ds, day) AS user__ds__day - , DATE_TRUNC(users_ds_source_src_10008.ds, isoweek) AS user__ds__week - , DATE_TRUNC(users_ds_source_src_10008.ds, month) AS user__ds__month - , DATE_TRUNC(users_ds_source_src_10008.ds, quarter) AS user__ds__quarter - , DATE_TRUNC(users_ds_source_src_10008.ds, year) AS user__ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS user__ds__extract_day - , IF(EXTRACT(dayofweek FROM users_ds_source_src_10008.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_10008.ds) - 1) AS user__ds__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_10008.ds) AS user__ds__extract_doy - , DATE_TRUNC(users_ds_source_src_10008.created_at, day) AS user__created_at__day - , DATE_TRUNC(users_ds_source_src_10008.created_at, isoweek) AS user__created_at__week - , DATE_TRUNC(users_ds_source_src_10008.created_at, month) AS user__created_at__month - , DATE_TRUNC(users_ds_source_src_10008.created_at, quarter) AS user__created_at__quarter - , DATE_TRUNC(users_ds_source_src_10008.created_at, year) AS user__created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_day - , IF(EXTRACT(dayofweek FROM users_ds_source_src_10008.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_10008.created_at) - 1) AS user__created_at__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_doy - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, day) AS user__ds_partitioned__day - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, isoweek) AS user__ds_partitioned__week - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, month) AS user__ds_partitioned__month - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, quarter) AS user__ds_partitioned__quarter - , DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, year) AS user__ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM users_ds_source_src_10008.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_10008.ds_partitioned) - 1) AS user__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state AS user__home_state - , users_ds_source_src_10008.user_id AS user - FROM ***************************.dim_users users_ds_source_src_10008 + DATE_TRUNC(users_ds_source_src_28008.ds, day) AS ds__day + , DATE_TRUNC(users_ds_source_src_28008.ds, isoweek) AS ds__week + , DATE_TRUNC(users_ds_source_src_28008.ds, month) AS ds__month + , DATE_TRUNC(users_ds_source_src_28008.ds, quarter) AS ds__quarter + , DATE_TRUNC(users_ds_source_src_28008.ds, year) AS ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28008.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28008.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28008.ds) AS ds__extract_doy + , DATE_TRUNC(users_ds_source_src_28008.created_at, day) AS created_at__day + , DATE_TRUNC(users_ds_source_src_28008.created_at, isoweek) AS created_at__week + , DATE_TRUNC(users_ds_source_src_28008.created_at, month) AS created_at__month + , DATE_TRUNC(users_ds_source_src_28008.created_at, quarter) AS created_at__quarter + , DATE_TRUNC(users_ds_source_src_28008.created_at, year) AS created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS created_at__extract_day + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28008.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28008.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28008.created_at) AS created_at__extract_doy + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28008.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28008.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state + , DATE_TRUNC(users_ds_source_src_28008.ds, day) AS user__ds__day + , DATE_TRUNC(users_ds_source_src_28008.ds, isoweek) AS user__ds__week + , DATE_TRUNC(users_ds_source_src_28008.ds, month) AS user__ds__month + , DATE_TRUNC(users_ds_source_src_28008.ds, quarter) AS user__ds__quarter + , DATE_TRUNC(users_ds_source_src_28008.ds, year) AS user__ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS user__ds__extract_day + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28008.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28008.ds) - 1) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28008.ds) AS user__ds__extract_doy + , DATE_TRUNC(users_ds_source_src_28008.created_at, day) AS user__created_at__day + , DATE_TRUNC(users_ds_source_src_28008.created_at, isoweek) AS user__created_at__week + , DATE_TRUNC(users_ds_source_src_28008.created_at, month) AS user__created_at__month + , DATE_TRUNC(users_ds_source_src_28008.created_at, quarter) AS user__created_at__quarter + , DATE_TRUNC(users_ds_source_src_28008.created_at, year) AS user__created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_day + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28008.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28008.created_at) - 1) AS user__created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_doy + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, day) AS user__ds_partitioned__day + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, isoweek) AS user__ds_partitioned__week + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, month) AS user__ds_partitioned__month + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, quarter) AS user__ds_partitioned__quarter + , DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, year) AS user__ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28008.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28008.ds_partitioned) - 1) AS user__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state AS user__home_state + , users_ds_source_src_28008.user_id AS user + FROM ***************************.dim_users users_ds_source_src_28008 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql index f39dd075f4..a37ab6164a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_ds_source_src_10008.home_state AS user__home_state + users_ds_source_src_28008.home_state AS user__home_state , SUM(subq_10.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' @@ -13,15 +13,15 @@ FROM ( DATE_TRUNC(ds_partitioned, day) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications - FROM ***************************.fct_id_verifications id_verifications_src_10004 + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_10 LEFT OUTER JOIN - ***************************.dim_users users_ds_source_src_10008 + ***************************.dim_users users_ds_source_src_28008 ON ( - subq_10.user = users_ds_source_src_10008.user_id + subq_10.user = users_ds_source_src_28008.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC(users_ds_source_src_10008.ds_partitioned, day) + subq_10.ds_partitioned__day = DATE_TRUNC(users_ds_source_src_28008.ds_partitioned, day) ) GROUP BY user__home_state diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql index 117ccadbc3..7734b8a156 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -339,93 +339,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0_optimized.sql index 65962ecb83..ccc0d8cd89 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_19 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql index 8944c5ec59..438bee63bc 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 WHERE listing__country_latest = 'us' ) subq_1 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0_optimized.sql index 7d0117953d..22b719da85 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_distinct_values__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql index aa6a3cfe95..36e7aa5354 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -143,93 +143,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -312,62 +312,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql index 0dbe3c135e..fdbb61ce0e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing__country_latest'] SELECT subq_13.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,12 +20,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_13.listing = listings_latest_src_10005.listing_id + subq_13.listing = listings_latest_src_28005.listing_id ) subq_18 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql index 033208d019..2065f841d1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql @@ -139,87 +139,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -233,60 +233,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql index 9330ebf5a1..fc848091b1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__capacity', 'metric_time__day'] SELECT subq_12.metric_time__day AS metric_time__day - , listings_src_10019.capacity AS listing__capacity + , listings_src_26002.capacity AS listing__capacity , subq_12.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,21 +20,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_12 LEFT OUTER JOIN - ***************************.dim_listings listings_src_10019 + ***************************.dim_listings listings_src_26002 ON ( - subq_12.listing = listings_src_10019.listing_id + subq_12.listing = listings_src_26002.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10019.active_from + subq_12.metric_time__day >= listings_src_26002.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10019.active_to + subq_12.metric_time__day < listings_src_26002.active_to ) OR ( - listings_src_10019.active_to IS NULL + listings_src_26002.active_to IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql index 4f74c48749..8509c1b208 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql @@ -123,93 +123,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0_optimized.sql index 854fec185d..a71f7ae0e8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_limit_rows__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql index 0456d25a6a..e560e7c411 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql @@ -86,62 +86,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0_optimized.sql index 557dd4d7a1..8486e86449 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT country AS listing__country_latest , 1 AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql index be176ec948..b39ef66d2b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql @@ -155,93 +155,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -324,62 +324,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -540,93 +540,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -709,62 +709,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -902,93 +902,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0_optimized.sql index 04e7ce6824..69ba3892a2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0_optimized.sql @@ -21,14 +21,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', bookings_source_src_10001.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + DATE_TRUNC('day', bookings_source_src_28001.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_37 WHERE listing__is_lux_latest GROUP BY @@ -47,7 +47,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'metric_time__day'] SELECT subq_44.metric_time__day AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_44.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -57,12 +57,12 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_44 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_44.listing = listings_latest_src_10005.listing_id + subq_44.listing = listings_latest_src_28005.listing_id ) subq_49 WHERE listing__is_lux_latest GROUP BY @@ -79,7 +79,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_58 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql index f1fbbf1bb3..7ab61ee90b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -359,93 +359,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 5a24120e5a..d384201243 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 WHERE booking__is_instant GROUP BY @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_24 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 66a3b7b644..c3f735c506 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -135,93 +135,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 7033ceae33..df414b0013 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 WHERE NOT booking__is_instant GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index d195071949..145648b100 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -302,62 +302,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql index e47268d9c5..13f8ff2353 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -20,5 +20,5 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_20 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0.sql index 67efaeb945..9b68bd0453 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0.sql @@ -10,62 +10,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 GROUP BY subq_0.listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0_optimized.sql index c48879553a..c1da0c0382 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_categorical__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['listing__country_latest',] SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 GROUP BY country ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0.sql index 72bb0d36cc..ac6e043c67 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0_optimized.sql index eece5dee9b..280b915894 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__day',] SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0.sql index 368367e9a4..ea8910605f 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__quarter diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0_optimized.sql index ed459675f1..f6d583edbe 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_min_max_only_time_quarter__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('quarter', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql index eb1f42cd6b..95a99ec92d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -292,60 +292,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -404,32 +404,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10023.ds) AS ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10023.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS ds__extract_doy - , users_latest_src_10023.home_state_latest - , DATE_TRUNC('day', users_latest_src_10023.ds) AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS user__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_10023.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS user__ds__extract_doy - , users_latest_src_10023.home_state_latest AS user__home_state_latest - , users_latest_src_10023.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10023 + DATE_TRUNC('day', users_latest_src_26006.ds) AS ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_26006.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS ds__extract_doy + , users_latest_src_26006.home_state_latest + , DATE_TRUNC('day', users_latest_src_26006.ds) AS user__ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS user__ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS user__ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_26006.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS user__ds__extract_doy + , users_latest_src_26006.home_state_latest AS user__home_state_latest + , users_latest_src_26006.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_26006 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql index b2b07d3bab..1d7e6c24a7 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10019.active_from AS window_start__day - , listings_src_10019.active_to AS window_end__day - , listings_src_10019.listing_id AS listing - , users_latest_src_10023.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , listings_src_26002.active_to AS window_end__day + , listings_src_26002.listing_id AS listing + , users_latest_src_26006.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings listings_src_26002 LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_10023 + ***************************.dim_users_latest users_latest_src_26006 ON - listings_src_10019.user_id = users_latest_src_10023.user_id + listings_src_26002.user_id = users_latest_src_26006.user_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql index 8da61c61b9..013554e39e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -253,10 +253,10 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT - lux_listing_mapping_src_10020.listing_id AS listing - , lux_listing_mapping_src_10020.lux_listing_id AS lux_listing - , lux_listing_mapping_src_10020.lux_listing_id AS listing__lux_listing - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listing_mapping_src_26003.listing_id AS listing + , lux_listing_mapping_src_26003.lux_listing_id AS lux_listing + , lux_listing_mapping_src_26003.lux_listing_id AS listing__lux_listing + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -359,54 +359,54 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT - lux_listings_src_10021.valid_from AS window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS window_start__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_10021.valid_from) AS window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS window_start__extract_doy - , lux_listings_src_10021.valid_to AS window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS window_end__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_10021.valid_to) AS window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux - , lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS lux_listing__window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS lux_listing__window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS lux_listing__window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS lux_listing__window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_doy - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS lux_listing__window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS lux_listing__window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS lux_listing__window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS lux_listing__window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - , lux_listings_src_10021.lux_listing_id AS lux_listing - FROM ***************************.dim_lux_listings lux_listings_src_10021 + lux_listings_src_26004.valid_from AS window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_26004.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS window_start__extract_doy + , lux_listings_src_26004.valid_to AS window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_26004.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux + , lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS lux_listing__window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS lux_listing__window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS lux_listing__window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS lux_listing__window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_doy + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS lux_listing__window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS lux_listing__window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS lux_listing__window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS lux_listing__window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + , lux_listings_src_26004.lux_listing_id AS lux_listing + FROM ***************************.dim_lux_listings lux_listings_src_26004 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql index bdf9f86508..0ef5f08ffa 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['lux_listing__is_confirmed_lux', 'lux_listing__window_start__day', 'lux_listing__window_end__day', 'listing'] SELECT - lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , lux_listing_mapping_src_10020.listing_id AS listing - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , lux_listing_mapping_src_26003.listing_id AS listing + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 LEFT OUTER JOIN - ***************************.dim_lux_listings lux_listings_src_10021 + ***************************.dim_lux_listings lux_listings_src_26004 ON - lux_listing_mapping_src_10020.lux_listing_id = lux_listings_src_10021.lux_listing_id + lux_listing_mapping_src_26003.lux_listing_id = lux_listings_src_26004.lux_listing_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql index f67081b41b..761fdeec7d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql @@ -91,55 +91,55 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT - account_month_txns_src_10012.txn_count - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_10012.ds) AS ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS ds__extract_doy - , account_month_txns_src_10012.account_month - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS account_id__ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS account_id__ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS account_id__ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS account_id__ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS account_id__ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_doy - , account_month_txns_src_10012.account_month AS account_id__account_month - , account_month_txns_src_10012.account_id - FROM ***************************.account_month_txns account_month_txns_src_10012 + account_month_txns_src_22000.txn_count + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy + , account_month_txns_src_22000.account_month + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy + , account_month_txns_src_22000.account_month AS account_id__account_month + , account_month_txns_src_22000.account_id + FROM ***************************.account_month_txns account_month_txns_src_22000 ) subq_0 ) subq_1 ) subq_2 @@ -209,48 +209,48 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bridge_table' SELECT - bridge_table_src_10013.extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS account_id__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy - , bridge_table_src_10013.account_id - , bridge_table_src_10013.customer_id - , bridge_table_src_10013.customer_id AS account_id__customer_id - , bridge_table_src_10013.account_id AS bridge_account__account_id - , bridge_table_src_10013.customer_id AS bridge_account__customer_id - FROM ***************************.bridge_table bridge_table_src_10013 + bridge_table_src_22001.extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS account_id__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS bridge_account__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy + , bridge_table_src_22001.account_id + , bridge_table_src_22001.customer_id + , bridge_table_src_22001.customer_id AS account_id__customer_id + , bridge_table_src_22001.account_id AS bridge_account__account_id + , bridge_table_src_22001.customer_id AS bridge_account__customer_id + FROM ***************************.bridge_table bridge_table_src_22001 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -313,34 +313,34 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_table' SELECT - customer_table_src_10015.customer_name - , customer_table_src_10015.customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_doy - , customer_table_src_10015.customer_name AS customer_id__customer_name - , customer_table_src_10015.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_doy - , customer_table_src_10015.customer_id - FROM ***************************.customer_table customer_table_src_10015 + customer_table_src_22003.customer_name + , customer_table_src_22003.customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_doy + , customer_table_src_22003.customer_name AS customer_id__customer_name + , customer_table_src_22003.customer_atomic_weight AS customer_id__customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , customer_table_src_22003.customer_id + FROM ***************************.customer_table customer_table_src_22003 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql index 37c292fbea..7802d2f867 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql @@ -4,30 +4,30 @@ -- Compute Metrics via Expressions SELECT subq_18.customer_id__customer_name AS account_id__customer_id__customer_name - , SUM(account_month_txns_src_10012.txn_count) AS txn_count -FROM ***************************.account_month_txns account_month_txns_src_10012 + , SUM(account_month_txns_src_22000.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_22000 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , bridge_table_src_10013.account_id AS account_id - , customer_table_src_10015.customer_name AS customer_id__customer_name - FROM ***************************.bridge_table bridge_table_src_10013 + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , bridge_table_src_22001.account_id AS account_id + , customer_table_src_22003.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_22001 LEFT OUTER JOIN - ***************************.customer_table customer_table_src_10015 + ***************************.customer_table customer_table_src_22003 ON ( - bridge_table_src_10013.customer_id = customer_table_src_10015.customer_id + bridge_table_src_22001.customer_id = customer_table_src_22003.customer_id ) AND ( - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) = DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) ) ) subq_18 ON ( - account_month_txns_src_10012.account_id = subq_18.account_id + account_month_txns_src_22000.account_id = subq_18.account_id ) AND ( - DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) = subq_18.ds_partitioned__day + DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_18.ds_partitioned__day ) GROUP BY subq_18.customer_id__customer_name diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql index 779175bf60..e00740355f 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' @@ -471,62 +471,62 @@ CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 ) subq_7 WHERE subq_7.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0_optimized.sql index 04b9fde0a3..2691ca3c38 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_17 CROSS JOIN ( @@ -23,6 +23,6 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 WHERE DATE_TRUNC('day', created_at) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_23 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql index 4acc007231..b8b5cc62a8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql @@ -94,56 +94,56 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user - FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_0 ) subq_1 ) subq_2 @@ -156,76 +156,76 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_10008.ds) AS ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_10008.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state - , DATE_TRUNC('day', users_ds_source_src_10008.ds) AS user__ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS user__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS user__ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS user__created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS user__created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS user__created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS user__created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS user__created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state AS user__home_state - , users_ds_source_src_10008.user_id AS user - FROM ***************************.dim_users users_ds_source_src_10008 + DATE_TRUNC('day', users_ds_source_src_28008.ds) AS ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_28008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_28008.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state + , DATE_TRUNC('day', users_ds_source_src_28008.ds) AS user__ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS user__ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS user__ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_28008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS user__ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS user__created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS user__created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS user__created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS user__created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS user__created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state AS user__home_state + , users_ds_source_src_28008.user_id AS user + FROM ***************************.dim_users users_ds_source_src_28008 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql index 74fbab8b7e..9f15f9bb3d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_ds_source_src_10008.home_state AS user__home_state + users_ds_source_src_28008.home_state AS user__home_state , SUM(subq_10.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' @@ -13,15 +13,15 @@ FROM ( DATE_TRUNC('day', ds_partitioned) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications - FROM ***************************.fct_id_verifications id_verifications_src_10004 + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_10 LEFT OUTER JOIN - ***************************.dim_users users_ds_source_src_10008 + ***************************.dim_users users_ds_source_src_28008 ON ( - subq_10.user = users_ds_source_src_10008.user_id + subq_10.user = users_ds_source_src_28008.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) + subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) ) GROUP BY - users_ds_source_src_10008.home_state + users_ds_source_src_28008.home_state diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql index 02ed082b1f..4075567205 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -339,93 +339,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0_optimized.sql index 65962ecb83..ccc0d8cd89 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_19 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql index 1aaca2cbed..a1d54bfa48 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 WHERE listing__country_latest = 'us' ) subq_1 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0_optimized.sql index 7d0117953d..22b719da85 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql index 5316c00ffd..fce16f303c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -143,93 +143,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -312,62 +312,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql index 0dbe3c135e..fdbb61ce0e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing__country_latest'] SELECT subq_13.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,12 +20,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_13.listing = listings_latest_src_10005.listing_id + subq_13.listing = listings_latest_src_28005.listing_id ) subq_18 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql index 9374e5008b..96c20638a0 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql @@ -139,87 +139,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -233,60 +233,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql index 9330ebf5a1..fc848091b1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__capacity', 'metric_time__day'] SELECT subq_12.metric_time__day AS metric_time__day - , listings_src_10019.capacity AS listing__capacity + , listings_src_26002.capacity AS listing__capacity , subq_12.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,21 +20,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_12 LEFT OUTER JOIN - ***************************.dim_listings listings_src_10019 + ***************************.dim_listings listings_src_26002 ON ( - subq_12.listing = listings_src_10019.listing_id + subq_12.listing = listings_src_26002.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10019.active_from + subq_12.metric_time__day >= listings_src_26002.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10019.active_to + subq_12.metric_time__day < listings_src_26002.active_to ) OR ( - listings_src_10019.active_to IS NULL + listings_src_26002.active_to IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql index 23754c9db8..f70d1c6eae 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql @@ -123,93 +123,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0_optimized.sql index 854fec185d..a71f7ae0e8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql index a54c8cdb93..a16164c267 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql @@ -86,62 +86,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0_optimized.sql index 557dd4d7a1..8486e86449 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT country AS listing__country_latest , 1 AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql index 5811d9c36a..5564f9e3a9 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql @@ -155,93 +155,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -324,62 +324,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -540,93 +540,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -709,62 +709,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -902,93 +902,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0_optimized.sql index 04e7ce6824..69ba3892a2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0_optimized.sql @@ -21,14 +21,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', bookings_source_src_10001.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + DATE_TRUNC('day', bookings_source_src_28001.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_37 WHERE listing__is_lux_latest GROUP BY @@ -47,7 +47,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'metric_time__day'] SELECT subq_44.metric_time__day AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_44.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -57,12 +57,12 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_44 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_44.listing = listings_latest_src_10005.listing_id + subq_44.listing = listings_latest_src_28005.listing_id ) subq_49 WHERE listing__is_lux_latest GROUP BY @@ -79,7 +79,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_58 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql index 2583784fe7..fa5987a04a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -359,93 +359,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 5a24120e5a..d384201243 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 WHERE booking__is_instant GROUP BY @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_24 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 424240a106..5c2c621376 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -135,93 +135,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 7033ceae33..df414b0013 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 WHERE NOT booking__is_instant GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 44d8607069..e3ba21dd52 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -302,62 +302,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql index e47268d9c5..13f8ff2353 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -20,5 +20,5 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_20 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0.sql index 909426ff06..f5a38c336c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0.sql @@ -10,62 +10,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 GROUP BY subq_0.listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0_optimized.sql index c48879553a..c1da0c0382 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_categorical__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['listing__country_latest',] SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 GROUP BY country ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0.sql index 91c2c51308..3bce77fb28 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0_optimized.sql index eece5dee9b..280b915894 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__day',] SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0.sql index c9bc754e9c..53624696bc 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__quarter diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0_optimized.sql index ed459675f1..f6d583edbe 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_only_time_quarter__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('quarter', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql index a4f9d37f9c..25db7e1f1e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -292,60 +292,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -404,32 +404,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10023.ds) AS ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS ds__extract_day - , EXTRACT(isodow FROM users_latest_src_10023.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS ds__extract_doy - , users_latest_src_10023.home_state_latest - , DATE_TRUNC('day', users_latest_src_10023.ds) AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS user__ds__extract_day - , EXTRACT(isodow FROM users_latest_src_10023.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS user__ds__extract_doy - , users_latest_src_10023.home_state_latest AS user__home_state_latest - , users_latest_src_10023.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10023 + DATE_TRUNC('day', users_latest_src_26006.ds) AS ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS ds__extract_day + , EXTRACT(isodow FROM users_latest_src_26006.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS ds__extract_doy + , users_latest_src_26006.home_state_latest + , DATE_TRUNC('day', users_latest_src_26006.ds) AS user__ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS user__ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS user__ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS user__ds__extract_day + , EXTRACT(isodow FROM users_latest_src_26006.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS user__ds__extract_doy + , users_latest_src_26006.home_state_latest AS user__home_state_latest + , users_latest_src_26006.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_26006 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql index b2b07d3bab..1d7e6c24a7 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10019.active_from AS window_start__day - , listings_src_10019.active_to AS window_end__day - , listings_src_10019.listing_id AS listing - , users_latest_src_10023.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , listings_src_26002.active_to AS window_end__day + , listings_src_26002.listing_id AS listing + , users_latest_src_26006.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings listings_src_26002 LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_10023 + ***************************.dim_users_latest users_latest_src_26006 ON - listings_src_10019.user_id = users_latest_src_10023.user_id + listings_src_26002.user_id = users_latest_src_26006.user_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql index 04960ddedd..98c67a81c2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -253,10 +253,10 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT - lux_listing_mapping_src_10020.listing_id AS listing - , lux_listing_mapping_src_10020.lux_listing_id AS lux_listing - , lux_listing_mapping_src_10020.lux_listing_id AS listing__lux_listing - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listing_mapping_src_26003.listing_id AS listing + , lux_listing_mapping_src_26003.lux_listing_id AS lux_listing + , lux_listing_mapping_src_26003.lux_listing_id AS listing__lux_listing + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -359,54 +359,54 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT - lux_listings_src_10021.valid_from AS window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS window_start__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_from) AS window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS window_start__extract_doy - , lux_listings_src_10021.valid_to AS window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS window_end__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_to) AS window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux - , lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS lux_listing__window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS lux_listing__window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS lux_listing__window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS lux_listing__window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_doy - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS lux_listing__window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS lux_listing__window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS lux_listing__window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS lux_listing__window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - , lux_listings_src_10021.lux_listing_id AS lux_listing - FROM ***************************.dim_lux_listings lux_listings_src_10021 + lux_listings_src_26004.valid_from AS window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS window_start__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS window_start__extract_doy + , lux_listings_src_26004.valid_to AS window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS window_end__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux + , lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS lux_listing__window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS lux_listing__window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS lux_listing__window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS lux_listing__window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_doy + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS lux_listing__window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS lux_listing__window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS lux_listing__window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS lux_listing__window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + , lux_listings_src_26004.lux_listing_id AS lux_listing + FROM ***************************.dim_lux_listings lux_listings_src_26004 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql index bdf9f86508..0ef5f08ffa 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['lux_listing__is_confirmed_lux', 'lux_listing__window_start__day', 'lux_listing__window_end__day', 'listing'] SELECT - lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , lux_listing_mapping_src_10020.listing_id AS listing - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , lux_listing_mapping_src_26003.listing_id AS listing + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 LEFT OUTER JOIN - ***************************.dim_lux_listings lux_listings_src_10021 + ***************************.dim_lux_listings lux_listings_src_26004 ON - lux_listing_mapping_src_10020.lux_listing_id = lux_listings_src_10021.lux_listing_id + lux_listing_mapping_src_26003.lux_listing_id = lux_listings_src_26004.lux_listing_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql index f5dca88000..ebedc871a4 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql @@ -91,55 +91,55 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT - account_month_txns_src_10012.txn_count - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS ds__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds) AS ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS ds__extract_doy - , account_month_txns_src_10012.account_month - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS account_id__ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS account_id__ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS account_id__ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS account_id__ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS account_id__ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_doy - , account_month_txns_src_10012.account_month AS account_id__account_month - , account_month_txns_src_10012.account_id - FROM ***************************.account_month_txns account_month_txns_src_10012 + account_month_txns_src_22000.txn_count + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy + , account_month_txns_src_22000.account_month + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy + , account_month_txns_src_22000.account_month AS account_id__account_month + , account_month_txns_src_22000.account_id + FROM ***************************.account_month_txns account_month_txns_src_22000 ) subq_0 ) subq_1 ) subq_2 @@ -209,48 +209,48 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bridge_table' SELECT - bridge_table_src_10013.extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS account_id__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(isodow FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_day - , EXTRACT(isodow FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy - , bridge_table_src_10013.account_id - , bridge_table_src_10013.customer_id - , bridge_table_src_10013.customer_id AS account_id__customer_id - , bridge_table_src_10013.account_id AS bridge_account__account_id - , bridge_table_src_10013.customer_id AS bridge_account__customer_id - FROM ***************************.bridge_table bridge_table_src_10013 + bridge_table_src_22001.extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS account_id__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(isodow FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS bridge_account__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(isodow FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy + , bridge_table_src_22001.account_id + , bridge_table_src_22001.customer_id + , bridge_table_src_22001.customer_id AS account_id__customer_id + , bridge_table_src_22001.account_id AS bridge_account__account_id + , bridge_table_src_22001.customer_id AS bridge_account__customer_id + FROM ***************************.bridge_table bridge_table_src_22001 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -313,34 +313,34 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_table' SELECT - customer_table_src_10015.customer_name - , customer_table_src_10015.customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_doy - , customer_table_src_10015.customer_name AS customer_id__customer_name - , customer_table_src_10015.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , EXTRACT(isodow FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_doy - , customer_table_src_10015.customer_id - FROM ***************************.customer_table customer_table_src_10015 + customer_table_src_22003.customer_name + , customer_table_src_22003.customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_doy + , customer_table_src_22003.customer_name AS customer_id__customer_name + , customer_table_src_22003.customer_atomic_weight AS customer_id__customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(isodow FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , customer_table_src_22003.customer_id + FROM ***************************.customer_table customer_table_src_22003 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql index 37c292fbea..7802d2f867 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql @@ -4,30 +4,30 @@ -- Compute Metrics via Expressions SELECT subq_18.customer_id__customer_name AS account_id__customer_id__customer_name - , SUM(account_month_txns_src_10012.txn_count) AS txn_count -FROM ***************************.account_month_txns account_month_txns_src_10012 + , SUM(account_month_txns_src_22000.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_22000 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , bridge_table_src_10013.account_id AS account_id - , customer_table_src_10015.customer_name AS customer_id__customer_name - FROM ***************************.bridge_table bridge_table_src_10013 + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , bridge_table_src_22001.account_id AS account_id + , customer_table_src_22003.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_22001 LEFT OUTER JOIN - ***************************.customer_table customer_table_src_10015 + ***************************.customer_table customer_table_src_22003 ON ( - bridge_table_src_10013.customer_id = customer_table_src_10015.customer_id + bridge_table_src_22001.customer_id = customer_table_src_22003.customer_id ) AND ( - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) = DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) ) ) subq_18 ON ( - account_month_txns_src_10012.account_id = subq_18.account_id + account_month_txns_src_22000.account_id = subq_18.account_id ) AND ( - DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) = subq_18.ds_partitioned__day + DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_18.ds_partitioned__day ) GROUP BY subq_18.customer_id__customer_name diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql index 7e8e16bff9..819dc05fc2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' @@ -471,62 +471,62 @@ CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 ) subq_7 WHERE subq_7.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0_optimized.sql index 04b9fde0a3..2691ca3c38 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_17 CROSS JOIN ( @@ -23,6 +23,6 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 WHERE DATE_TRUNC('day', created_at) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_23 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql index 090e9f97ad..f8e4a004b6 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql @@ -94,56 +94,56 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user - FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_0 ) subq_1 ) subq_2 @@ -156,76 +156,76 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_10008.ds) AS ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS ds__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state - , DATE_TRUNC('day', users_ds_source_src_10008.ds) AS user__ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS user__ds__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS user__ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS user__created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS user__created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS user__created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS user__created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS user__created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state AS user__home_state - , users_ds_source_src_10008.user_id AS user - FROM ***************************.dim_users users_ds_source_src_10008 + DATE_TRUNC('day', users_ds_source_src_28008.ds) AS ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS ds__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state + , DATE_TRUNC('day', users_ds_source_src_28008.ds) AS user__ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS user__ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS user__ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS user__ds__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS user__ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS user__created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS user__created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS user__created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS user__created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS user__created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state AS user__home_state + , users_ds_source_src_28008.user_id AS user + FROM ***************************.dim_users users_ds_source_src_28008 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql index 74fbab8b7e..9f15f9bb3d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_ds_source_src_10008.home_state AS user__home_state + users_ds_source_src_28008.home_state AS user__home_state , SUM(subq_10.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' @@ -13,15 +13,15 @@ FROM ( DATE_TRUNC('day', ds_partitioned) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications - FROM ***************************.fct_id_verifications id_verifications_src_10004 + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_10 LEFT OUTER JOIN - ***************************.dim_users users_ds_source_src_10008 + ***************************.dim_users users_ds_source_src_28008 ON ( - subq_10.user = users_ds_source_src_10008.user_id + subq_10.user = users_ds_source_src_28008.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) + subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) ) GROUP BY - users_ds_source_src_10008.home_state + users_ds_source_src_28008.home_state diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql index 02ed082b1f..4075567205 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -339,93 +339,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0_optimized.sql index 65962ecb83..ccc0d8cd89 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_19 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql index 1aaca2cbed..a1d54bfa48 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 WHERE listing__country_latest = 'us' ) subq_1 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0_optimized.sql index 7d0117953d..22b719da85 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_distinct_values__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql index 5316c00ffd..fce16f303c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -143,93 +143,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -312,62 +312,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql index 0dbe3c135e..fdbb61ce0e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing__country_latest'] SELECT subq_13.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,12 +20,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_13.listing = listings_latest_src_10005.listing_id + subq_13.listing = listings_latest_src_28005.listing_id ) subq_18 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql index 9374e5008b..96c20638a0 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql @@ -139,87 +139,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -233,60 +233,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql index 9330ebf5a1..fc848091b1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__capacity', 'metric_time__day'] SELECT subq_12.metric_time__day AS metric_time__day - , listings_src_10019.capacity AS listing__capacity + , listings_src_26002.capacity AS listing__capacity , subq_12.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,21 +20,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_12 LEFT OUTER JOIN - ***************************.dim_listings listings_src_10019 + ***************************.dim_listings listings_src_26002 ON ( - subq_12.listing = listings_src_10019.listing_id + subq_12.listing = listings_src_26002.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10019.active_from + subq_12.metric_time__day >= listings_src_26002.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10019.active_to + subq_12.metric_time__day < listings_src_26002.active_to ) OR ( - listings_src_10019.active_to IS NULL + listings_src_26002.active_to IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql index 23754c9db8..f70d1c6eae 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql @@ -123,93 +123,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0_optimized.sql index 854fec185d..a71f7ae0e8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_limit_rows__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql index a54c8cdb93..a16164c267 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql @@ -86,62 +86,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0_optimized.sql index 557dd4d7a1..8486e86449 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT country AS listing__country_latest , 1 AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql index 5811d9c36a..5564f9e3a9 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql @@ -155,93 +155,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -324,62 +324,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -540,93 +540,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -709,62 +709,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -902,93 +902,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0_optimized.sql index 04e7ce6824..69ba3892a2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0_optimized.sql @@ -21,14 +21,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', bookings_source_src_10001.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + DATE_TRUNC('day', bookings_source_src_28001.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_37 WHERE listing__is_lux_latest GROUP BY @@ -47,7 +47,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'metric_time__day'] SELECT subq_44.metric_time__day AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_44.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -57,12 +57,12 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_44 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_44.listing = listings_latest_src_10005.listing_id + subq_44.listing = listings_latest_src_28005.listing_id ) subq_49 WHERE listing__is_lux_latest GROUP BY @@ -79,7 +79,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_58 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql index df0542a1ba..076627353a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -359,93 +359,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql index ea88e9e19d..bc8639fea2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 WHERE booking__is_instant GROUP BY @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_24 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 424240a106..5c2c621376 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -135,93 +135,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 7033ceae33..df414b0013 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 WHERE NOT booking__is_instant GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 6a75634f9e..4944ea2a89 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -302,62 +302,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql index 0aa738f6f7..201c81c126 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -20,5 +20,5 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_20 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0.sql index 909426ff06..f5a38c336c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0.sql @@ -10,62 +10,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 GROUP BY subq_0.listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0_optimized.sql index c48879553a..c1da0c0382 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_categorical__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['listing__country_latest',] SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 GROUP BY country ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0.sql index 91c2c51308..3bce77fb28 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0_optimized.sql index eece5dee9b..280b915894 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__day',] SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0.sql index c9bc754e9c..53624696bc 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__quarter diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0_optimized.sql index ed459675f1..f6d583edbe 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_min_max_only_time_quarter__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('quarter', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql index a4f9d37f9c..25db7e1f1e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -292,60 +292,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(isodow FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(isodow FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -404,32 +404,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10023.ds) AS ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS ds__extract_day - , EXTRACT(isodow FROM users_latest_src_10023.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS ds__extract_doy - , users_latest_src_10023.home_state_latest - , DATE_TRUNC('day', users_latest_src_10023.ds) AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS user__ds__extract_day - , EXTRACT(isodow FROM users_latest_src_10023.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS user__ds__extract_doy - , users_latest_src_10023.home_state_latest AS user__home_state_latest - , users_latest_src_10023.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10023 + DATE_TRUNC('day', users_latest_src_26006.ds) AS ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS ds__extract_day + , EXTRACT(isodow FROM users_latest_src_26006.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS ds__extract_doy + , users_latest_src_26006.home_state_latest + , DATE_TRUNC('day', users_latest_src_26006.ds) AS user__ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS user__ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS user__ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS user__ds__extract_day + , EXTRACT(isodow FROM users_latest_src_26006.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS user__ds__extract_doy + , users_latest_src_26006.home_state_latest AS user__home_state_latest + , users_latest_src_26006.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_26006 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql index b2b07d3bab..1d7e6c24a7 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10019.active_from AS window_start__day - , listings_src_10019.active_to AS window_end__day - , listings_src_10019.listing_id AS listing - , users_latest_src_10023.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , listings_src_26002.active_to AS window_end__day + , listings_src_26002.listing_id AS listing + , users_latest_src_26006.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings listings_src_26002 LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_10023 + ***************************.dim_users_latest users_latest_src_26006 ON - listings_src_10019.user_id = users_latest_src_10023.user_id + listings_src_26002.user_id = users_latest_src_26006.user_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql index 04960ddedd..98c67a81c2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -253,10 +253,10 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT - lux_listing_mapping_src_10020.listing_id AS listing - , lux_listing_mapping_src_10020.lux_listing_id AS lux_listing - , lux_listing_mapping_src_10020.lux_listing_id AS listing__lux_listing - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listing_mapping_src_26003.listing_id AS listing + , lux_listing_mapping_src_26003.lux_listing_id AS lux_listing + , lux_listing_mapping_src_26003.lux_listing_id AS listing__lux_listing + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -359,54 +359,54 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT - lux_listings_src_10021.valid_from AS window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS window_start__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_from) AS window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS window_start__extract_doy - , lux_listings_src_10021.valid_to AS window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS window_end__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_to) AS window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux - , lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS lux_listing__window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS lux_listing__window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS lux_listing__window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS lux_listing__window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_doy - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS lux_listing__window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS lux_listing__window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS lux_listing__window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS lux_listing__window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_day - , EXTRACT(isodow FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - , lux_listings_src_10021.lux_listing_id AS lux_listing - FROM ***************************.dim_lux_listings lux_listings_src_10021 + lux_listings_src_26004.valid_from AS window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS window_start__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS window_start__extract_doy + , lux_listings_src_26004.valid_to AS window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS window_end__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux + , lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS lux_listing__window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS lux_listing__window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS lux_listing__window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS lux_listing__window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_doy + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS lux_listing__window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS lux_listing__window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS lux_listing__window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS lux_listing__window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(isodow FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + , lux_listings_src_26004.lux_listing_id AS lux_listing + FROM ***************************.dim_lux_listings lux_listings_src_26004 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql index bdf9f86508..0ef5f08ffa 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['lux_listing__is_confirmed_lux', 'lux_listing__window_start__day', 'lux_listing__window_end__day', 'listing'] SELECT - lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , lux_listing_mapping_src_10020.listing_id AS listing - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , lux_listing_mapping_src_26003.listing_id AS listing + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 LEFT OUTER JOIN - ***************************.dim_lux_listings lux_listings_src_10021 + ***************************.dim_lux_listings lux_listings_src_26004 ON - lux_listing_mapping_src_10020.lux_listing_id = lux_listings_src_10021.lux_listing_id + lux_listing_mapping_src_26003.lux_listing_id = lux_listings_src_26004.lux_listing_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql index f5dca88000..ebedc871a4 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql @@ -91,55 +91,55 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT - account_month_txns_src_10012.txn_count - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS ds__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds) AS ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS ds__extract_doy - , account_month_txns_src_10012.account_month - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS account_id__ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS account_id__ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS account_id__ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS account_id__ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS account_id__ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_day - , EXTRACT(isodow FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_doy - , account_month_txns_src_10012.account_month AS account_id__account_month - , account_month_txns_src_10012.account_id - FROM ***************************.account_month_txns account_month_txns_src_10012 + account_month_txns_src_22000.txn_count + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy + , account_month_txns_src_22000.account_month + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day + , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy + , account_month_txns_src_22000.account_month AS account_id__account_month + , account_month_txns_src_22000.account_id + FROM ***************************.account_month_txns account_month_txns_src_22000 ) subq_0 ) subq_1 ) subq_2 @@ -209,48 +209,48 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bridge_table' SELECT - bridge_table_src_10013.extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS account_id__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(isodow FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_day - , EXTRACT(isodow FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy - , bridge_table_src_10013.account_id - , bridge_table_src_10013.customer_id - , bridge_table_src_10013.customer_id AS account_id__customer_id - , bridge_table_src_10013.account_id AS bridge_account__account_id - , bridge_table_src_10013.customer_id AS bridge_account__customer_id - FROM ***************************.bridge_table bridge_table_src_10013 + bridge_table_src_22001.extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS account_id__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(isodow FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS bridge_account__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(isodow FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy + , bridge_table_src_22001.account_id + , bridge_table_src_22001.customer_id + , bridge_table_src_22001.customer_id AS account_id__customer_id + , bridge_table_src_22001.account_id AS bridge_account__account_id + , bridge_table_src_22001.customer_id AS bridge_account__customer_id + FROM ***************************.bridge_table bridge_table_src_22001 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -313,34 +313,34 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_table' SELECT - customer_table_src_10015.customer_name - , customer_table_src_10015.customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_doy - , customer_table_src_10015.customer_name AS customer_id__customer_name - , customer_table_src_10015.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , EXTRACT(isodow FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_doy - , customer_table_src_10015.customer_id - FROM ***************************.customer_table customer_table_src_10015 + customer_table_src_22003.customer_name + , customer_table_src_22003.customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_doy + , customer_table_src_22003.customer_name AS customer_id__customer_name + , customer_table_src_22003.customer_atomic_weight AS customer_id__customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(isodow FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , customer_table_src_22003.customer_id + FROM ***************************.customer_table customer_table_src_22003 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql index 37c292fbea..7802d2f867 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql @@ -4,30 +4,30 @@ -- Compute Metrics via Expressions SELECT subq_18.customer_id__customer_name AS account_id__customer_id__customer_name - , SUM(account_month_txns_src_10012.txn_count) AS txn_count -FROM ***************************.account_month_txns account_month_txns_src_10012 + , SUM(account_month_txns_src_22000.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_22000 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , bridge_table_src_10013.account_id AS account_id - , customer_table_src_10015.customer_name AS customer_id__customer_name - FROM ***************************.bridge_table bridge_table_src_10013 + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , bridge_table_src_22001.account_id AS account_id + , customer_table_src_22003.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_22001 LEFT OUTER JOIN - ***************************.customer_table customer_table_src_10015 + ***************************.customer_table customer_table_src_22003 ON ( - bridge_table_src_10013.customer_id = customer_table_src_10015.customer_id + bridge_table_src_22001.customer_id = customer_table_src_22003.customer_id ) AND ( - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) = DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) ) ) subq_18 ON ( - account_month_txns_src_10012.account_id = subq_18.account_id + account_month_txns_src_22000.account_id = subq_18.account_id ) AND ( - DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) = subq_18.ds_partitioned__day + DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_18.ds_partitioned__day ) GROUP BY subq_18.customer_id__customer_name diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql index 7e8e16bff9..819dc05fc2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' @@ -471,62 +471,62 @@ CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(isodow FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 ) subq_7 WHERE subq_7.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0_optimized.sql index 04b9fde0a3..2691ca3c38 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_17 CROSS JOIN ( @@ -23,6 +23,6 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 WHERE DATE_TRUNC('day', created_at) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_23 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql index 090e9f97ad..f8e4a004b6 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql @@ -94,56 +94,56 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(isodow FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user - FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_0 ) subq_1 ) subq_2 @@ -156,76 +156,76 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_10008.ds) AS ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS ds__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS created_at__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state - , DATE_TRUNC('day', users_ds_source_src_10008.ds) AS user__ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS user__ds__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS user__ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS user__created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS user__created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS user__created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS user__created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS user__created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_day - , EXTRACT(isodow FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state AS user__home_state - , users_ds_source_src_10008.user_id AS user - FROM ***************************.dim_users users_ds_source_src_10008 + DATE_TRUNC('day', users_ds_source_src_28008.ds) AS ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS ds__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS created_at__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state + , DATE_TRUNC('day', users_ds_source_src_28008.ds) AS user__ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS user__ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS user__ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS user__ds__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS user__ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS user__created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS user__created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS user__created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS user__created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS user__created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(isodow FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state AS user__home_state + , users_ds_source_src_28008.user_id AS user + FROM ***************************.dim_users users_ds_source_src_28008 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql index 74fbab8b7e..9f15f9bb3d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_ds_source_src_10008.home_state AS user__home_state + users_ds_source_src_28008.home_state AS user__home_state , SUM(subq_10.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' @@ -13,15 +13,15 @@ FROM ( DATE_TRUNC('day', ds_partitioned) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications - FROM ***************************.fct_id_verifications id_verifications_src_10004 + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_10 LEFT OUTER JOIN - ***************************.dim_users users_ds_source_src_10008 + ***************************.dim_users users_ds_source_src_28008 ON ( - subq_10.user = users_ds_source_src_10008.user_id + subq_10.user = users_ds_source_src_28008.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) + subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) ) GROUP BY - users_ds_source_src_10008.home_state + users_ds_source_src_28008.home_state diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql index 65ef01965d..9f9ae05e28 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -339,93 +339,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0_optimized.sql index 65962ecb83..ccc0d8cd89 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_19 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql index a1716efc30..4de43d5069 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 WHERE listing__country_latest = 'us' ) subq_1 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0_optimized.sql index 7d0117953d..22b719da85 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_distinct_values__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql index 0192e5d43c..34c747f02c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -143,93 +143,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -312,62 +312,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql index 0dbe3c135e..fdbb61ce0e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing__country_latest'] SELECT subq_13.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,12 +20,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_13.listing = listings_latest_src_10005.listing_id + subq_13.listing = listings_latest_src_28005.listing_id ) subq_18 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql index c38911074e..4f5a80d623 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql @@ -139,87 +139,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.paid_at) END AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.paid_at) END AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -233,60 +233,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_from) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_from) END AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_to) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_to) END AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_from) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_from) END AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_to) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_to) END AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_from) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_from) END AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_to) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_to) END AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_from) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_from) END AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_to) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_to) END AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql index 9330ebf5a1..fc848091b1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__capacity', 'metric_time__day'] SELECT subq_12.metric_time__day AS metric_time__day - , listings_src_10019.capacity AS listing__capacity + , listings_src_26002.capacity AS listing__capacity , subq_12.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,21 +20,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_12 LEFT OUTER JOIN - ***************************.dim_listings listings_src_10019 + ***************************.dim_listings listings_src_26002 ON ( - subq_12.listing = listings_src_10019.listing_id + subq_12.listing = listings_src_26002.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10019.active_from + subq_12.metric_time__day >= listings_src_26002.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10019.active_to + subq_12.metric_time__day < listings_src_26002.active_to ) OR ( - listings_src_10019.active_to IS NULL + listings_src_26002.active_to IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql index 7fa040141d..641c2f16d6 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql @@ -123,93 +123,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0_optimized.sql index 854fec185d..a71f7ae0e8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_limit_rows__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql index d233af1bf5..e233020779 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql @@ -86,62 +86,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0_optimized.sql index 557dd4d7a1..8486e86449 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT country AS listing__country_latest , 1 AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql index 4933f9a815..f70a5bfcb6 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql @@ -155,93 +155,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -324,62 +324,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -540,93 +540,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -709,62 +709,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -902,93 +902,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0_optimized.sql index 04e7ce6824..69ba3892a2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0_optimized.sql @@ -21,14 +21,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', bookings_source_src_10001.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + DATE_TRUNC('day', bookings_source_src_28001.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_37 WHERE listing__is_lux_latest GROUP BY @@ -47,7 +47,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'metric_time__day'] SELECT subq_44.metric_time__day AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_44.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -57,12 +57,12 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_44 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_44.listing = listings_latest_src_10005.listing_id + subq_44.listing = listings_latest_src_28005.listing_id ) subq_49 WHERE listing__is_lux_latest GROUP BY @@ -79,7 +79,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_58 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql index 2f0fd567c5..83369d2e19 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -359,93 +359,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql index ea88e9e19d..bc8639fea2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 WHERE booking__is_instant GROUP BY @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_24 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 6e02e131c3..b39aae10e1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -135,93 +135,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 7033ceae33..df414b0013 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 WHERE NOT booking__is_instant GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index c1c43b6603..799b2601de 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -302,62 +302,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql index 0aa738f6f7..201c81c126 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -20,5 +20,5 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_20 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0.sql index 9fef91d6c9..b0c482aaa1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0.sql @@ -10,62 +10,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 GROUP BY subq_0.listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0_optimized.sql index c48879553a..c1da0c0382 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_categorical__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['listing__country_latest',] SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 GROUP BY country ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0.sql index 4c2d268665..a66e06cc63 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0_optimized.sql index eece5dee9b..280b915894 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__day',] SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0.sql index aa47db94cb..37667b848c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__quarter diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0_optimized.sql index ed459675f1..f6d583edbe 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_min_max_only_time_quarter__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('quarter', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql index bd234df53e..3b8dc1a9ee 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.paid_at) END AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.paid_at) END AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -292,60 +292,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_from) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_from) END AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_to) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_to) END AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_from) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_from) END AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , CASE WHEN EXTRACT(dow FROM listings_src_10019.active_to) = 0 THEN EXTRACT(dow FROM listings_src_10019.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_10019.active_to) END AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_from) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_from) END AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_to) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_to) END AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_from) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_from) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_from) END AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , CASE WHEN EXTRACT(dow FROM listings_src_26002.active_to) = 0 THEN EXTRACT(dow FROM listings_src_26002.active_to) + 7 ELSE EXTRACT(dow FROM listings_src_26002.active_to) END AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -404,32 +404,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10023.ds) AS ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10023.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10023.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10023.ds) END AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS ds__extract_doy - , users_latest_src_10023.home_state_latest - , DATE_TRUNC('day', users_latest_src_10023.ds) AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS user__ds__extract_day - , CASE WHEN EXTRACT(dow FROM users_latest_src_10023.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_10023.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_10023.ds) END AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS user__ds__extract_doy - , users_latest_src_10023.home_state_latest AS user__home_state_latest - , users_latest_src_10023.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10023 + DATE_TRUNC('day', users_latest_src_26006.ds) AS ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_26006.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_26006.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_26006.ds) END AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS ds__extract_doy + , users_latest_src_26006.home_state_latest + , DATE_TRUNC('day', users_latest_src_26006.ds) AS user__ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS user__ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS user__ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS user__ds__extract_day + , CASE WHEN EXTRACT(dow FROM users_latest_src_26006.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_26006.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_26006.ds) END AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS user__ds__extract_doy + , users_latest_src_26006.home_state_latest AS user__home_state_latest + , users_latest_src_26006.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_26006 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql index b2b07d3bab..1d7e6c24a7 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10019.active_from AS window_start__day - , listings_src_10019.active_to AS window_end__day - , listings_src_10019.listing_id AS listing - , users_latest_src_10023.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , listings_src_26002.active_to AS window_end__day + , listings_src_26002.listing_id AS listing + , users_latest_src_26006.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings listings_src_26002 LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_10023 + ***************************.dim_users_latest users_latest_src_26006 ON - listings_src_10019.user_id = users_latest_src_10023.user_id + listings_src_26002.user_id = users_latest_src_26006.user_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql index 60b8a56376..36efbb0f7b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.paid_at) END AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10017.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10017.paid_at) END AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_26000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_26000.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -253,10 +253,10 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT - lux_listing_mapping_src_10020.listing_id AS listing - , lux_listing_mapping_src_10020.lux_listing_id AS lux_listing - , lux_listing_mapping_src_10020.lux_listing_id AS listing__lux_listing - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listing_mapping_src_26003.listing_id AS listing + , lux_listing_mapping_src_26003.lux_listing_id AS lux_listing + , lux_listing_mapping_src_26003.lux_listing_id AS listing__lux_listing + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -359,54 +359,54 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT - lux_listings_src_10021.valid_from AS window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS window_start__extract_day - , CASE WHEN EXTRACT(dow FROM lux_listings_src_10021.valid_from) = 0 THEN EXTRACT(dow FROM lux_listings_src_10021.valid_from) + 7 ELSE EXTRACT(dow FROM lux_listings_src_10021.valid_from) END AS window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS window_start__extract_doy - , lux_listings_src_10021.valid_to AS window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS window_end__extract_day - , CASE WHEN EXTRACT(dow FROM lux_listings_src_10021.valid_to) = 0 THEN EXTRACT(dow FROM lux_listings_src_10021.valid_to) + 7 ELSE EXTRACT(dow FROM lux_listings_src_10021.valid_to) END AS window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux - , lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS lux_listing__window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS lux_listing__window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS lux_listing__window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS lux_listing__window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_day - , CASE WHEN EXTRACT(dow FROM lux_listings_src_10021.valid_from) = 0 THEN EXTRACT(dow FROM lux_listings_src_10021.valid_from) + 7 ELSE EXTRACT(dow FROM lux_listings_src_10021.valid_from) END AS lux_listing__window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_doy - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS lux_listing__window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS lux_listing__window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS lux_listing__window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS lux_listing__window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_day - , CASE WHEN EXTRACT(dow FROM lux_listings_src_10021.valid_to) = 0 THEN EXTRACT(dow FROM lux_listings_src_10021.valid_to) + 7 ELSE EXTRACT(dow FROM lux_listings_src_10021.valid_to) END AS lux_listing__window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - , lux_listings_src_10021.lux_listing_id AS lux_listing - FROM ***************************.dim_lux_listings lux_listings_src_10021 + lux_listings_src_26004.valid_from AS window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS window_start__extract_day + , CASE WHEN EXTRACT(dow FROM lux_listings_src_26004.valid_from) = 0 THEN EXTRACT(dow FROM lux_listings_src_26004.valid_from) + 7 ELSE EXTRACT(dow FROM lux_listings_src_26004.valid_from) END AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS window_start__extract_doy + , lux_listings_src_26004.valid_to AS window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS window_end__extract_day + , CASE WHEN EXTRACT(dow FROM lux_listings_src_26004.valid_to) = 0 THEN EXTRACT(dow FROM lux_listings_src_26004.valid_to) + 7 ELSE EXTRACT(dow FROM lux_listings_src_26004.valid_to) END AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux + , lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS lux_listing__window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS lux_listing__window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS lux_listing__window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS lux_listing__window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_day + , CASE WHEN EXTRACT(dow FROM lux_listings_src_26004.valid_from) = 0 THEN EXTRACT(dow FROM lux_listings_src_26004.valid_from) + 7 ELSE EXTRACT(dow FROM lux_listings_src_26004.valid_from) END AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_doy + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS lux_listing__window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS lux_listing__window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS lux_listing__window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS lux_listing__window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_day + , CASE WHEN EXTRACT(dow FROM lux_listings_src_26004.valid_to) = 0 THEN EXTRACT(dow FROM lux_listings_src_26004.valid_to) + 7 ELSE EXTRACT(dow FROM lux_listings_src_26004.valid_to) END AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + , lux_listings_src_26004.lux_listing_id AS lux_listing + FROM ***************************.dim_lux_listings lux_listings_src_26004 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql index bdf9f86508..0ef5f08ffa 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['lux_listing__is_confirmed_lux', 'lux_listing__window_start__day', 'lux_listing__window_end__day', 'listing'] SELECT - lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , lux_listing_mapping_src_10020.listing_id AS listing - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , lux_listing_mapping_src_26003.listing_id AS listing + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 LEFT OUTER JOIN - ***************************.dim_lux_listings lux_listings_src_10021 + ***************************.dim_lux_listings lux_listings_src_26004 ON - lux_listing_mapping_src_10020.lux_listing_id = lux_listings_src_10021.lux_listing_id + lux_listing_mapping_src_26003.lux_listing_id = lux_listings_src_26004.lux_listing_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql index 0d617749ca..ff72ab3310 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql @@ -91,55 +91,55 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT - account_month_txns_src_10012.txn_count - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM account_month_txns_src_10012.ds_partitioned) = 0 THEN EXTRACT(dow FROM account_month_txns_src_10012.ds_partitioned) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_10012.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM account_month_txns_src_10012.ds) = 0 THEN EXTRACT(dow FROM account_month_txns_src_10012.ds) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_10012.ds) END AS ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS ds__extract_doy - , account_month_txns_src_10012.account_month - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM account_month_txns_src_10012.ds_partitioned) = 0 THEN EXTRACT(dow FROM account_month_txns_src_10012.ds_partitioned) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_10012.ds_partitioned) END AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS account_id__ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS account_id__ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS account_id__ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS account_id__ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS account_id__ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_day - , CASE WHEN EXTRACT(dow FROM account_month_txns_src_10012.ds) = 0 THEN EXTRACT(dow FROM account_month_txns_src_10012.ds) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_10012.ds) END AS account_id__ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_doy - , account_month_txns_src_10012.account_month AS account_id__account_month - , account_month_txns_src_10012.account_id - FROM ***************************.account_month_txns account_month_txns_src_10012 + account_month_txns_src_22000.txn_count + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy + , account_month_txns_src_22000.account_month + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) END AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day + , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds) END AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy + , account_month_txns_src_22000.account_month AS account_id__account_month + , account_month_txns_src_22000.account_id + FROM ***************************.account_month_txns account_month_txns_src_22000 ) subq_0 ) subq_1 ) subq_2 @@ -209,48 +209,48 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bridge_table' SELECT - bridge_table_src_10013.extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS account_id__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) END AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_10013.ds_partitioned) END AS bridge_account__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy - , bridge_table_src_10013.account_id - , bridge_table_src_10013.customer_id - , bridge_table_src_10013.customer_id AS account_id__customer_id - , bridge_table_src_10013.account_id AS bridge_account__account_id - , bridge_table_src_10013.customer_id AS bridge_account__customer_id - FROM ***************************.bridge_table bridge_table_src_10013 + bridge_table_src_22001.extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS account_id__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) END AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS bridge_account__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22001.ds_partitioned) END AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy + , bridge_table_src_22001.account_id + , bridge_table_src_22001.customer_id + , bridge_table_src_22001.customer_id AS account_id__customer_id + , bridge_table_src_22001.account_id AS bridge_account__account_id + , bridge_table_src_22001.customer_id AS bridge_account__customer_id + FROM ***************************.bridge_table bridge_table_src_22001 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -313,34 +313,34 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_table' SELECT - customer_table_src_10015.customer_name - , customer_table_src_10015.customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM customer_table_src_10015.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_10015.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_10015.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_doy - , customer_table_src_10015.customer_name AS customer_id__customer_name - , customer_table_src_10015.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM customer_table_src_10015.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_10015.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_10015.ds_partitioned) END AS customer_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_doy - , customer_table_src_10015.customer_id - FROM ***************************.customer_table customer_table_src_10015 + customer_table_src_22003.customer_name + , customer_table_src_22003.customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM customer_table_src_22003.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_22003.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_22003.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_doy + , customer_table_src_22003.customer_name AS customer_id__customer_name + , customer_table_src_22003.customer_atomic_weight AS customer_id__customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM customer_table_src_22003.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_22003.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_22003.ds_partitioned) END AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , customer_table_src_22003.customer_id + FROM ***************************.customer_table customer_table_src_22003 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql index 37c292fbea..7802d2f867 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql @@ -4,30 +4,30 @@ -- Compute Metrics via Expressions SELECT subq_18.customer_id__customer_name AS account_id__customer_id__customer_name - , SUM(account_month_txns_src_10012.txn_count) AS txn_count -FROM ***************************.account_month_txns account_month_txns_src_10012 + , SUM(account_month_txns_src_22000.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_22000 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , bridge_table_src_10013.account_id AS account_id - , customer_table_src_10015.customer_name AS customer_id__customer_name - FROM ***************************.bridge_table bridge_table_src_10013 + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , bridge_table_src_22001.account_id AS account_id + , customer_table_src_22003.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_22001 LEFT OUTER JOIN - ***************************.customer_table customer_table_src_10015 + ***************************.customer_table customer_table_src_22003 ON ( - bridge_table_src_10013.customer_id = customer_table_src_10015.customer_id + bridge_table_src_22001.customer_id = customer_table_src_22003.customer_id ) AND ( - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) = DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) ) ) subq_18 ON ( - account_month_txns_src_10012.account_id = subq_18.account_id + account_month_txns_src_22000.account_id = subq_18.account_id ) AND ( - DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) = subq_18.ds_partitioned__day + DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_18.ds_partitioned__day ) GROUP BY subq_18.customer_id__customer_name diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql index 6f2c83a6bc..54c6113672 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' @@ -471,62 +471,62 @@ CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM listings_latest_src_10005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_10005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_10005.created_at) END AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 ) subq_7 WHERE subq_7.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0_optimized.sql index 04b9fde0a3..2691ca3c38 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_17 CROSS JOIN ( @@ -23,6 +23,6 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 WHERE DATE_TRUNC('day', created_at) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_23 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql index 8b49710344..f13ef5a49e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql @@ -94,56 +94,56 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds) END AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds) END AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_10004.ds_partitioned) END AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user - FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds) END AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds) END AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) END AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_0 ) subq_1 ) subq_2 @@ -156,76 +156,76 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_10008.ds) AS ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_10008.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_10008.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_10008.ds) END AS ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS created_at__extract_day - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_10008.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_10008.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_10008.created_at) END AS created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_10008.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_10008.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_10008.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state - , DATE_TRUNC('day', users_ds_source_src_10008.ds) AS user__ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS user__ds__extract_day - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_10008.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_10008.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_10008.ds) END AS user__ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS user__ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS user__created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS user__created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS user__created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS user__created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS user__created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_day - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_10008.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_10008.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_10008.created_at) END AS user__created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_10008.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_10008.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_10008.ds_partitioned) END AS user__ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state AS user__home_state - , users_ds_source_src_10008.user_id AS user - FROM ***************************.dim_users users_ds_source_src_10008 + DATE_TRUNC('day', users_ds_source_src_28008.ds) AS ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28008.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28008.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28008.ds) END AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS created_at__extract_day + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28008.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28008.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28008.created_at) END AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28008.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28008.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28008.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state + , DATE_TRUNC('day', users_ds_source_src_28008.ds) AS user__ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS user__ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS user__ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS user__ds__extract_day + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28008.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28008.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28008.ds) END AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS user__ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS user__created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS user__created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS user__created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS user__created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS user__created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_day + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28008.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28008.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28008.created_at) END AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28008.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28008.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28008.ds_partitioned) END AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state AS user__home_state + , users_ds_source_src_28008.user_id AS user + FROM ***************************.dim_users users_ds_source_src_28008 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql index 74fbab8b7e..9f15f9bb3d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_ds_source_src_10008.home_state AS user__home_state + users_ds_source_src_28008.home_state AS user__home_state , SUM(subq_10.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' @@ -13,15 +13,15 @@ FROM ( DATE_TRUNC('day', ds_partitioned) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications - FROM ***************************.fct_id_verifications id_verifications_src_10004 + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_10 LEFT OUTER JOIN - ***************************.dim_users users_ds_source_src_10008 + ***************************.dim_users users_ds_source_src_28008 ON ( - subq_10.user = users_ds_source_src_10008.user_id + subq_10.user = users_ds_source_src_28008.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) + subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) ) GROUP BY - users_ds_source_src_10008.home_state + users_ds_source_src_28008.home_state diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql index 581932ccb0..8d2fbedfb7 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -339,93 +339,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0_optimized.sql index 65962ecb83..ccc0d8cd89 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_19 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql index 9016bcec56..bee4c90b0a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 WHERE listing__country_latest = 'us' ) subq_1 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0_optimized.sql index 7d0117953d..22b719da85 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql index 58ef7b6514..3bab159275 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -143,93 +143,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -312,62 +312,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql index 0dbe3c135e..fdbb61ce0e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing__country_latest'] SELECT subq_13.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,12 +20,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_13.listing = listings_latest_src_10005.listing_id + subq_13.listing = listings_latest_src_28005.listing_id ) subq_18 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql index 1f5f79befa..9ce4b38f01 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql @@ -139,87 +139,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -233,60 +233,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql index 9330ebf5a1..fc848091b1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__capacity', 'metric_time__day'] SELECT subq_12.metric_time__day AS metric_time__day - , listings_src_10019.capacity AS listing__capacity + , listings_src_26002.capacity AS listing__capacity , subq_12.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,21 +20,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_12 LEFT OUTER JOIN - ***************************.dim_listings listings_src_10019 + ***************************.dim_listings listings_src_26002 ON ( - subq_12.listing = listings_src_10019.listing_id + subq_12.listing = listings_src_26002.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10019.active_from + subq_12.metric_time__day >= listings_src_26002.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10019.active_to + subq_12.metric_time__day < listings_src_26002.active_to ) OR ( - listings_src_10019.active_to IS NULL + listings_src_26002.active_to IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql index 6bac8ae890..53f2360a79 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql @@ -123,93 +123,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0_optimized.sql index 854fec185d..a71f7ae0e8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql index 9518e5af67..ffecf2d0db 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql @@ -86,62 +86,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0_optimized.sql index 557dd4d7a1..8486e86449 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT country AS listing__country_latest , 1 AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql index 929e50cfe2..9f1663dda3 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql @@ -155,93 +155,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -324,62 +324,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -540,93 +540,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -709,62 +709,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -902,93 +902,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0_optimized.sql index 04e7ce6824..69ba3892a2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0_optimized.sql @@ -21,14 +21,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', bookings_source_src_10001.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + DATE_TRUNC('day', bookings_source_src_28001.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_37 WHERE listing__is_lux_latest GROUP BY @@ -47,7 +47,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'metric_time__day'] SELECT subq_44.metric_time__day AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_44.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -57,12 +57,12 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_44 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_44.listing = listings_latest_src_10005.listing_id + subq_44.listing = listings_latest_src_28005.listing_id ) subq_49 WHERE listing__is_lux_latest GROUP BY @@ -79,7 +79,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_58 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql index 4e03813330..cd1568ae84 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -359,93 +359,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 5a24120e5a..d384201243 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 WHERE booking__is_instant GROUP BY @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_24 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 1940c226c3..40af5c2e28 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -135,93 +135,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 7033ceae33..df414b0013 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 WHERE NOT booking__is_instant GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 9dbbc4e5fb..2bef26e558 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -302,62 +302,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql index e47268d9c5..13f8ff2353 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -20,5 +20,5 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_20 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0.sql index b3cbe0e613..43b74e5a69 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0.sql @@ -10,62 +10,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 GROUP BY subq_0.listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0_optimized.sql index c48879553a..c1da0c0382 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_categorical__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['listing__country_latest',] SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 GROUP BY country ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0.sql index cc58087032..025fd50a2a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0_optimized.sql index eece5dee9b..280b915894 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__day',] SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0.sql index beb483af46..0ee263acd6 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__quarter diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0_optimized.sql index ed459675f1..f6d583edbe 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_min_max_only_time_quarter__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('quarter', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql index a55074fd58..cdf345df4c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -292,60 +292,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(dayofweekiso FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(dayofweekiso FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -404,32 +404,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10023.ds) AS ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10023.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS ds__extract_doy - , users_latest_src_10023.home_state_latest - , DATE_TRUNC('day', users_latest_src_10023.ds) AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS user__ds__extract_day - , EXTRACT(dayofweekiso FROM users_latest_src_10023.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS user__ds__extract_doy - , users_latest_src_10023.home_state_latest AS user__home_state_latest - , users_latest_src_10023.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10023 + DATE_TRUNC('day', users_latest_src_26006.ds) AS ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_26006.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS ds__extract_doy + , users_latest_src_26006.home_state_latest + , DATE_TRUNC('day', users_latest_src_26006.ds) AS user__ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS user__ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS user__ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS user__ds__extract_day + , EXTRACT(dayofweekiso FROM users_latest_src_26006.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS user__ds__extract_doy + , users_latest_src_26006.home_state_latest AS user__home_state_latest + , users_latest_src_26006.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_26006 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql index b2b07d3bab..1d7e6c24a7 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10019.active_from AS window_start__day - , listings_src_10019.active_to AS window_end__day - , listings_src_10019.listing_id AS listing - , users_latest_src_10023.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , listings_src_26002.active_to AS window_end__day + , listings_src_26002.listing_id AS listing + , users_latest_src_26006.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings listings_src_26002 LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_10023 + ***************************.dim_users_latest users_latest_src_26006 ON - listings_src_10019.user_id = users_latest_src_10023.user_id + listings_src_26002.user_id = users_latest_src_26006.user_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql index d70d62230b..eeb60f62b4 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -253,10 +253,10 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT - lux_listing_mapping_src_10020.listing_id AS listing - , lux_listing_mapping_src_10020.lux_listing_id AS lux_listing - , lux_listing_mapping_src_10020.lux_listing_id AS listing__lux_listing - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listing_mapping_src_26003.listing_id AS listing + , lux_listing_mapping_src_26003.lux_listing_id AS lux_listing + , lux_listing_mapping_src_26003.lux_listing_id AS listing__lux_listing + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -359,54 +359,54 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT - lux_listings_src_10021.valid_from AS window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS window_start__extract_day - , EXTRACT(dayofweekiso FROM lux_listings_src_10021.valid_from) AS window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS window_start__extract_doy - , lux_listings_src_10021.valid_to AS window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS window_end__extract_day - , EXTRACT(dayofweekiso FROM lux_listings_src_10021.valid_to) AS window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux - , lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS lux_listing__window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS lux_listing__window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS lux_listing__window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS lux_listing__window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_day - , EXTRACT(dayofweekiso FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_doy - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS lux_listing__window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS lux_listing__window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS lux_listing__window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS lux_listing__window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_day - , EXTRACT(dayofweekiso FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - , lux_listings_src_10021.lux_listing_id AS lux_listing - FROM ***************************.dim_lux_listings lux_listings_src_10021 + lux_listings_src_26004.valid_from AS window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS window_start__extract_day + , EXTRACT(dayofweekiso FROM lux_listings_src_26004.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS window_start__extract_doy + , lux_listings_src_26004.valid_to AS window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS window_end__extract_day + , EXTRACT(dayofweekiso FROM lux_listings_src_26004.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux + , lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS lux_listing__window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS lux_listing__window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS lux_listing__window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS lux_listing__window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(dayofweekiso FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_doy + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS lux_listing__window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS lux_listing__window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS lux_listing__window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS lux_listing__window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(dayofweekiso FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + , lux_listings_src_26004.lux_listing_id AS lux_listing + FROM ***************************.dim_lux_listings lux_listings_src_26004 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql index bdf9f86508..0ef5f08ffa 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['lux_listing__is_confirmed_lux', 'lux_listing__window_start__day', 'lux_listing__window_end__day', 'listing'] SELECT - lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , lux_listing_mapping_src_10020.listing_id AS listing - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , lux_listing_mapping_src_26003.listing_id AS listing + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 LEFT OUTER JOIN - ***************************.dim_lux_listings lux_listings_src_10021 + ***************************.dim_lux_listings lux_listings_src_26004 ON - lux_listing_mapping_src_10020.lux_listing_id = lux_listings_src_10021.lux_listing_id + lux_listing_mapping_src_26003.lux_listing_id = lux_listings_src_26004.lux_listing_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql index f2f52429ae..dc8bf96a93 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql @@ -91,55 +91,55 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT - account_month_txns_src_10012.txn_count - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM account_month_txns_src_10012.ds) AS ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS ds__extract_doy - , account_month_txns_src_10012.account_month - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS account_id__ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS account_id__ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS account_id__ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS account_id__ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS account_id__ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_day - , EXTRACT(dayofweekiso FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_doy - , account_month_txns_src_10012.account_month AS account_id__account_month - , account_month_txns_src_10012.account_id - FROM ***************************.account_month_txns account_month_txns_src_10012 + account_month_txns_src_22000.txn_count + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy + , account_month_txns_src_22000.account_month + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day + , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy + , account_month_txns_src_22000.account_month AS account_id__account_month + , account_month_txns_src_22000.account_id + FROM ***************************.account_month_txns account_month_txns_src_22000 ) subq_0 ) subq_1 ) subq_2 @@ -209,48 +209,48 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bridge_table' SELECT - bridge_table_src_10013.extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS account_id__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy - , bridge_table_src_10013.account_id - , bridge_table_src_10013.customer_id - , bridge_table_src_10013.customer_id AS account_id__customer_id - , bridge_table_src_10013.account_id AS bridge_account__account_id - , bridge_table_src_10013.customer_id AS bridge_account__customer_id - FROM ***************************.bridge_table bridge_table_src_10013 + bridge_table_src_22001.extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS account_id__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS bridge_account__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy + , bridge_table_src_22001.account_id + , bridge_table_src_22001.customer_id + , bridge_table_src_22001.customer_id AS account_id__customer_id + , bridge_table_src_22001.account_id AS bridge_account__account_id + , bridge_table_src_22001.customer_id AS bridge_account__customer_id + FROM ***************************.bridge_table bridge_table_src_22001 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -313,34 +313,34 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_table' SELECT - customer_table_src_10015.customer_name - , customer_table_src_10015.customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_doy - , customer_table_src_10015.customer_name AS customer_id__customer_name - , customer_table_src_10015.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_doy - , customer_table_src_10015.customer_id - FROM ***************************.customer_table customer_table_src_10015 + customer_table_src_22003.customer_name + , customer_table_src_22003.customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_doy + , customer_table_src_22003.customer_name AS customer_id__customer_name + , customer_table_src_22003.customer_atomic_weight AS customer_id__customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , customer_table_src_22003.customer_id + FROM ***************************.customer_table customer_table_src_22003 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql index 37c292fbea..7802d2f867 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql @@ -4,30 +4,30 @@ -- Compute Metrics via Expressions SELECT subq_18.customer_id__customer_name AS account_id__customer_id__customer_name - , SUM(account_month_txns_src_10012.txn_count) AS txn_count -FROM ***************************.account_month_txns account_month_txns_src_10012 + , SUM(account_month_txns_src_22000.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_22000 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , bridge_table_src_10013.account_id AS account_id - , customer_table_src_10015.customer_name AS customer_id__customer_name - FROM ***************************.bridge_table bridge_table_src_10013 + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , bridge_table_src_22001.account_id AS account_id + , customer_table_src_22003.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_22001 LEFT OUTER JOIN - ***************************.customer_table customer_table_src_10015 + ***************************.customer_table customer_table_src_22003 ON ( - bridge_table_src_10013.customer_id = customer_table_src_10015.customer_id + bridge_table_src_22001.customer_id = customer_table_src_22003.customer_id ) AND ( - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) = DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) ) ) subq_18 ON ( - account_month_txns_src_10012.account_id = subq_18.account_id + account_month_txns_src_22000.account_id = subq_18.account_id ) AND ( - DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) = subq_18.ds_partitioned__day + DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_18.ds_partitioned__day ) GROUP BY subq_18.customer_id__customer_name diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql index aa9653ccbb..02bc987ced 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' @@ -471,62 +471,62 @@ CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(dayofweekiso FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 ) subq_7 WHERE subq_7.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0_optimized.sql index 04b9fde0a3..2691ca3c38 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_17 CROSS JOIN ( @@ -23,6 +23,6 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 WHERE DATE_TRUNC('day', created_at) BETWEEN '2020-01-01' AND '2020-01-01' ) subq_23 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql index 25fbd5c12d..23dde171d5 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql @@ -94,56 +94,56 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user - FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_0 ) subq_1 ) subq_2 @@ -156,76 +156,76 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_10008.ds) AS ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM users_ds_source_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS created_at__extract_day - , EXTRACT(dayofweekiso FROM users_ds_source_src_10008.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state - , DATE_TRUNC('day', users_ds_source_src_10008.ds) AS user__ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS user__ds__extract_day - , EXTRACT(dayofweekiso FROM users_ds_source_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS user__ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS user__created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS user__created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS user__created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS user__created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS user__created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_day - , EXTRACT(dayofweekiso FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_day - , EXTRACT(dayofweekiso FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state AS user__home_state - , users_ds_source_src_10008.user_id AS user - FROM ***************************.dim_users users_ds_source_src_10008 + DATE_TRUNC('day', users_ds_source_src_28008.ds) AS ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM users_ds_source_src_28008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS created_at__extract_day + , EXTRACT(dayofweekiso FROM users_ds_source_src_28008.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state + , DATE_TRUNC('day', users_ds_source_src_28008.ds) AS user__ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS user__ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS user__ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS user__ds__extract_day + , EXTRACT(dayofweekiso FROM users_ds_source_src_28008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS user__ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS user__created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS user__created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS user__created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS user__created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS user__created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_day + , EXTRACT(dayofweekiso FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state AS user__home_state + , users_ds_source_src_28008.user_id AS user + FROM ***************************.dim_users users_ds_source_src_28008 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql index 74fbab8b7e..9f15f9bb3d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_ds_source_src_10008.home_state AS user__home_state + users_ds_source_src_28008.home_state AS user__home_state , SUM(subq_10.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' @@ -13,15 +13,15 @@ FROM ( DATE_TRUNC('day', ds_partitioned) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications - FROM ***************************.fct_id_verifications id_verifications_src_10004 + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_10 LEFT OUTER JOIN - ***************************.dim_users users_ds_source_src_10008 + ***************************.dim_users users_ds_source_src_28008 ON ( - subq_10.user = users_ds_source_src_10008.user_id + subq_10.user = users_ds_source_src_28008.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) + subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) ) GROUP BY - users_ds_source_src_10008.home_state + users_ds_source_src_28008.home_state diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0.sql index d63f91ce4e..aa2f51f006 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -339,93 +339,93 @@ FULL OUTER JOIN ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0_optimized.sql index 65962ecb83..ccc0d8cd89 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_common_semantic_model__plan0_optimized.sql @@ -16,7 +16,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 GROUP BY metric_time__day @@ -30,7 +30,7 @@ FULL OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_19 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0.sql index 45bc9337c9..4d9264bf6f 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0.sql @@ -68,62 +68,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 WHERE listing__country_latest = 'us' ) subq_1 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0_optimized.sql index 7d0117953d..22b719da85 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_distinct_values__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0.sql index fff735b24b..15f0673d4d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -143,93 +143,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -312,62 +312,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql index 0dbe3c135e..fdbb61ce0e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing__country_latest'] SELECT subq_13.booking__is_instant AS booking__is_instant - , listings_latest_src_10005.country AS listing__country_latest + , listings_latest_src_28005.country AS listing__country_latest , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,12 +20,12 @@ FROM ( listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_13 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_13.listing = listings_latest_src_10005.listing_id + subq_13.listing = listings_latest_src_28005.listing_id ) subq_18 WHERE listing__country_latest = 'us' GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0.sql index 1a5c3e2b0f..0684457d26 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0.sql @@ -139,87 +139,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -233,60 +233,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0_optimized.sql index 9330ebf5a1..fc848091b1 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_join_to_scd_dimension__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__capacity', 'metric_time__day'] SELECT subq_12.metric_time__day AS metric_time__day - , listings_src_10019.capacity AS listing__capacity + , listings_src_26002.capacity AS listing__capacity , subq_12.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -20,21 +20,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_12 LEFT OUTER JOIN - ***************************.dim_listings listings_src_10019 + ***************************.dim_listings listings_src_26002 ON ( - subq_12.listing = listings_src_10019.listing_id + subq_12.listing = listings_src_26002.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10019.active_from + subq_12.metric_time__day >= listings_src_26002.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10019.active_to + subq_12.metric_time__day < listings_src_26002.active_to ) OR ( - listings_src_10019.active_to IS NULL + listings_src_26002.active_to IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0.sql index ee3f05c913..06cdb8896b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0.sql @@ -123,93 +123,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0_optimized.sql index 854fec185d..a71f7ae0e8 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_limit_rows__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS ds__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 GROUP BY ds__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0.sql index 8197a10ce7..cfc58a123a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0.sql @@ -86,62 +86,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0_optimized.sql index 557dd4d7a1..8486e86449 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_local_dimension_using_local_entity__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( SELECT country AS listing__country_latest , 1 AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 GROUP BY listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0.sql index d08fab33de..2fde56482f 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0.sql @@ -155,93 +155,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -324,62 +324,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_3 ) subq_4 ) subq_5 @@ -540,93 +540,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_12 ) subq_13 ) subq_14 @@ -709,62 +709,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_15 ) subq_16 ) subq_17 @@ -902,93 +902,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_24 ) subq_25 ) subq_26 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0_optimized.sql index 04e7ce6824..69ba3892a2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint__plan0_optimized.sql @@ -21,14 +21,14 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', bookings_source_src_10001.ds) AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , bookings_source_src_10001.booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + DATE_TRUNC('day', bookings_source_src_28001.ds) AS metric_time__day + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , bookings_source_src_28001.booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28001 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - bookings_source_src_10001.listing_id = listings_latest_src_10005.listing_id + bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id ) subq_37 WHERE listing__is_lux_latest GROUP BY @@ -47,7 +47,7 @@ FROM ( -- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'metric_time__day'] SELECT subq_44.metric_time__day AS metric_time__day - , listings_latest_src_10005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest , subq_44.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' @@ -57,12 +57,12 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_44 LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_10005 + ***************************.dim_listings_latest listings_latest_src_28005 ON - subq_44.listing = listings_latest_src_10005.listing_id + subq_44.listing = listings_latest_src_28005.listing_id ) subq_49 WHERE listing__is_lux_latest GROUP BY @@ -79,7 +79,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_58 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0.sql index c633942716..9c036af743 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0.sql @@ -141,93 +141,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -359,93 +359,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_7 ) subq_8 ) subq_9 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 5a24120e5a..d384201243 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -24,7 +24,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 WHERE booking__is_instant GROUP BY @@ -39,7 +39,7 @@ FROM ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , SUM(booking_value) AS booking_value - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', ds) ) subq_24 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 9136bf52f2..da0a36e00e 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -135,93 +135,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 7033ceae33..df414b0013 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -18,7 +18,7 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 WHERE NOT booking__is_instant GROUP BY diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 6b5e079813..7de9dc9aee 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -124,93 +124,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 @@ -302,62 +302,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_5 ) subq_6 ) subq_7 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql index e47268d9c5..13f8ff2353 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0_optimized.sql @@ -10,7 +10,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_15 CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' @@ -20,5 +20,5 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_20 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0.sql index 509c4bceef..f13704b88c 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0.sql @@ -10,62 +10,62 @@ FROM ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_0 GROUP BY subq_0.listing__country_latest diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0_optimized.sql index c48879553a..c1da0c0382 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_categorical__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['listing__country_latest',] SELECT country AS listing__country_latest - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 GROUP BY country ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0.sql index 59dd4b2cfb..888670ea3b 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__day diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0_optimized.sql index eece5dee9b..280b915894 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__day',] SELECT DATE_TRUNC('day', paid_at) AS booking__paid_at__day - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('day', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0.sql index b9c837d4eb..98be7043db 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0.sql @@ -11,93 +11,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 GROUP BY subq_0.booking__paid_at__quarter diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0_optimized.sql index ed459675f1..f6d583edbe 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_min_max_only_time_quarter__plan0_optimized.sql @@ -7,7 +7,7 @@ FROM ( -- Pass Only Elements: ['booking__paid_at__quarter',] SELECT DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 GROUP BY DATE_TRUNC('quarter', paid_at) ) subq_3 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0.sql index 833baf0f10..cf631e5e31 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -292,60 +292,60 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'listings' SELECT - listings_src_10019.active_from AS window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS window_start__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_from) AS window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS window_start__extract_doy - , listings_src_10019.active_to AS window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS window_end__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_to) AS window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS window_end__extract_doy - , listings_src_10019.country - , listings_src_10019.is_lux - , listings_src_10019.capacity - , listings_src_10019.active_from AS listing__window_start__day - , DATE_TRUNC('week', listings_src_10019.active_from) AS listing__window_start__week - , DATE_TRUNC('month', listings_src_10019.active_from) AS listing__window_start__month - , DATE_TRUNC('quarter', listings_src_10019.active_from) AS listing__window_start__quarter - , DATE_TRUNC('year', listings_src_10019.active_from) AS listing__window_start__year - , EXTRACT(year FROM listings_src_10019.active_from) AS listing__window_start__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_from) AS listing__window_start__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_from) AS listing__window_start__extract_month - , EXTRACT(day FROM listings_src_10019.active_from) AS listing__window_start__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_from) AS listing__window_start__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_from) AS listing__window_start__extract_doy - , listings_src_10019.active_to AS listing__window_end__day - , DATE_TRUNC('week', listings_src_10019.active_to) AS listing__window_end__week - , DATE_TRUNC('month', listings_src_10019.active_to) AS listing__window_end__month - , DATE_TRUNC('quarter', listings_src_10019.active_to) AS listing__window_end__quarter - , DATE_TRUNC('year', listings_src_10019.active_to) AS listing__window_end__year - , EXTRACT(year FROM listings_src_10019.active_to) AS listing__window_end__extract_year - , EXTRACT(quarter FROM listings_src_10019.active_to) AS listing__window_end__extract_quarter - , EXTRACT(month FROM listings_src_10019.active_to) AS listing__window_end__extract_month - , EXTRACT(day FROM listings_src_10019.active_to) AS listing__window_end__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_src_10019.active_to) AS listing__window_end__extract_dow - , EXTRACT(doy FROM listings_src_10019.active_to) AS listing__window_end__extract_doy - , listings_src_10019.country AS listing__country - , listings_src_10019.is_lux AS listing__is_lux - , listings_src_10019.capacity AS listing__capacity - , listings_src_10019.listing_id AS listing - , listings_src_10019.user_id AS user - , listings_src_10019.user_id AS listing__user - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS window_start__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS window_start__extract_doy + , listings_src_26002.active_to AS window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS window_end__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS window_end__extract_doy + , listings_src_26002.country + , listings_src_26002.is_lux + , listings_src_26002.capacity + , listings_src_26002.active_from AS listing__window_start__day + , DATE_TRUNC('week', listings_src_26002.active_from) AS listing__window_start__week + , DATE_TRUNC('month', listings_src_26002.active_from) AS listing__window_start__month + , DATE_TRUNC('quarter', listings_src_26002.active_from) AS listing__window_start__quarter + , DATE_TRUNC('year', listings_src_26002.active_from) AS listing__window_start__year + , EXTRACT(year FROM listings_src_26002.active_from) AS listing__window_start__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_from) AS listing__window_start__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_from) AS listing__window_start__extract_month + , EXTRACT(day FROM listings_src_26002.active_from) AS listing__window_start__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_from) AS listing__window_start__extract_doy + , listings_src_26002.active_to AS listing__window_end__day + , DATE_TRUNC('week', listings_src_26002.active_to) AS listing__window_end__week + , DATE_TRUNC('month', listings_src_26002.active_to) AS listing__window_end__month + , DATE_TRUNC('quarter', listings_src_26002.active_to) AS listing__window_end__quarter + , DATE_TRUNC('year', listings_src_26002.active_to) AS listing__window_end__year + , EXTRACT(year FROM listings_src_26002.active_to) AS listing__window_end__extract_year + , EXTRACT(quarter FROM listings_src_26002.active_to) AS listing__window_end__extract_quarter + , EXTRACT(month FROM listings_src_26002.active_to) AS listing__window_end__extract_month + , EXTRACT(day FROM listings_src_26002.active_to) AS listing__window_end__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_src_26002.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_26002.active_to) AS listing__window_end__extract_doy + , listings_src_26002.country AS listing__country + , listings_src_26002.is_lux AS listing__is_lux + , listings_src_26002.capacity AS listing__capacity + , listings_src_26002.listing_id AS listing + , listings_src_26002.user_id AS user + , listings_src_26002.user_id AS listing__user + FROM ***************************.dim_listings listings_src_26002 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -404,32 +404,32 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_latest' SELECT - DATE_TRUNC('day', users_latest_src_10023.ds) AS ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10023.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS ds__extract_doy - , users_latest_src_10023.home_state_latest - , DATE_TRUNC('day', users_latest_src_10023.ds) AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10023.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10023.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10023.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10023.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10023.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10023.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10023.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_latest_src_10023.ds) AS user__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_latest_src_10023.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10023.ds) AS user__ds__extract_doy - , users_latest_src_10023.home_state_latest AS user__home_state_latest - , users_latest_src_10023.user_id AS user - FROM ***************************.dim_users_latest users_latest_src_10023 + DATE_TRUNC('day', users_latest_src_26006.ds) AS ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_26006.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS ds__extract_doy + , users_latest_src_26006.home_state_latest + , DATE_TRUNC('day', users_latest_src_26006.ds) AS user__ds__day + , DATE_TRUNC('week', users_latest_src_26006.ds) AS user__ds__week + , DATE_TRUNC('month', users_latest_src_26006.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_latest_src_26006.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_latest_src_26006.ds) AS user__ds__year + , EXTRACT(year FROM users_latest_src_26006.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_latest_src_26006.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_latest_src_26006.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_latest_src_26006.ds) AS user__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_latest_src_26006.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_26006.ds) AS user__ds__extract_doy + , users_latest_src_26006.home_state_latest AS user__home_state_latest + , users_latest_src_26006.user_id AS user + FROM ***************************.dim_users_latest users_latest_src_26006 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0_optimized.sql index b2b07d3bab..1d7e6c24a7 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10019.active_from AS window_start__day - , listings_src_10019.active_to AS window_end__day - , listings_src_10019.listing_id AS listing - , users_latest_src_10023.home_state_latest AS user__home_state_latest - FROM ***************************.dim_listings listings_src_10019 + listings_src_26002.active_from AS window_start__day + , listings_src_26002.active_to AS window_end__day + , listings_src_26002.listing_id AS listing + , users_latest_src_26006.home_state_latest AS user__home_state_latest + FROM ***************************.dim_listings listings_src_26002 LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_10023 + ***************************.dim_users_latest users_latest_src_26006 ON - listings_src_10019.user_id = users_latest_src_10023.user_id + listings_src_26002.user_id = users_latest_src_26006.user_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0.sql index aafc603038..38f654bc9d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0.sql @@ -130,87 +130,87 @@ FROM ( SELECT 1 AS bookings , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings - , bookings_source_src_10017.booking_value - , bookings_source_src_10017.guest_id AS bookers - , bookings_source_src_10017.booking_value AS average_booking_value - , bookings_source_src_10017.booking_value AS booking_payments - , bookings_source_src_10017.is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.paid_at) AS paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS paid_at__extract_doy - , bookings_source_src_10017.is_instant AS booking__is_instant - , DATE_TRUNC('day', bookings_source_src_10017.ds) AS booking__ds__day - , DATE_TRUNC('week', bookings_source_src_10017.ds) AS booking__ds__week - , DATE_TRUNC('month', bookings_source_src_10017.ds) AS booking__ds__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds) AS booking__ds__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds) AS booking__ds__year - , EXTRACT(year FROM bookings_source_src_10017.ds) AS booking__ds__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds) AS booking__ds__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds) AS booking__ds__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__day - , DATE_TRUNC('week', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__week - , DATE_TRUNC('month', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__month - , DATE_TRUNC('quarter', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__quarter - , DATE_TRUNC('year', bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__year - , EXTRACT(year FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(day FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', bookings_source_src_10017.paid_at) AS booking__paid_at__day - , DATE_TRUNC('week', bookings_source_src_10017.paid_at) AS booking__paid_at__week - , DATE_TRUNC('month', bookings_source_src_10017.paid_at) AS booking__paid_at__month - , DATE_TRUNC('quarter', bookings_source_src_10017.paid_at) AS booking__paid_at__quarter - , DATE_TRUNC('year', bookings_source_src_10017.paid_at) AS booking__paid_at__year - , EXTRACT(year FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_year - , EXTRACT(quarter FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_quarter - , EXTRACT(month FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_month - , EXTRACT(day FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(doy FROM bookings_source_src_10017.paid_at) AS booking__paid_at__extract_doy - , bookings_source_src_10017.listing_id AS listing - , bookings_source_src_10017.guest_id AS guest - , bookings_source_src_10017.host_id AS host - , bookings_source_src_10017.guest_id AS user - , bookings_source_src_10017.listing_id AS booking__listing - , bookings_source_src_10017.guest_id AS booking__guest - , bookings_source_src_10017.host_id AS booking__host - , bookings_source_src_10017.guest_id AS booking__user - FROM ***************************.fct_bookings bookings_source_src_10017 + , bookings_source_src_26000.booking_value + , bookings_source_src_26000.guest_id AS bookers + , bookings_source_src_26000.booking_value AS average_booking_value + , bookings_source_src_26000.booking_value AS booking_payments + , bookings_source_src_26000.is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS paid_at__extract_doy + , bookings_source_src_26000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_26000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_26000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_26000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_26000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_26000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_26000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_26000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_26000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_26000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_26000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_26000.listing_id AS listing + , bookings_source_src_26000.guest_id AS guest + , bookings_source_src_26000.host_id AS host + , bookings_source_src_26000.guest_id AS user + , bookings_source_src_26000.listing_id AS booking__listing + , bookings_source_src_26000.guest_id AS booking__guest + , bookings_source_src_26000.host_id AS booking__host + , bookings_source_src_26000.guest_id AS booking__user + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_0 ) subq_1 ) subq_2 @@ -253,10 +253,10 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT - lux_listing_mapping_src_10020.listing_id AS listing - , lux_listing_mapping_src_10020.lux_listing_id AS lux_listing - , lux_listing_mapping_src_10020.lux_listing_id AS listing__lux_listing - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listing_mapping_src_26003.listing_id AS listing + , lux_listing_mapping_src_26003.lux_listing_id AS lux_listing + , lux_listing_mapping_src_26003.lux_listing_id AS listing__lux_listing + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -359,54 +359,54 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'lux_listings' SELECT - lux_listings_src_10021.valid_from AS window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS window_start__extract_day - , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_10021.valid_from) AS window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS window_start__extract_doy - , lux_listings_src_10021.valid_to AS window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS window_end__extract_day - , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_10021.valid_to) AS window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux - , lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_from) AS lux_listing__window_start__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_from) AS lux_listing__window_start__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_from) AS lux_listing__window_start__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_from) AS lux_listing__window_start__year - , EXTRACT(year FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_day - , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_from) AS lux_listing__window_start__extract_doy - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , DATE_TRUNC('week', lux_listings_src_10021.valid_to) AS lux_listing__window_end__week - , DATE_TRUNC('month', lux_listings_src_10021.valid_to) AS lux_listing__window_end__month - , DATE_TRUNC('quarter', lux_listings_src_10021.valid_to) AS lux_listing__window_end__quarter - , DATE_TRUNC('year', lux_listings_src_10021.valid_to) AS lux_listing__window_end__year - , EXTRACT(year FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_year - , EXTRACT(quarter FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_quarter - , EXTRACT(month FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(day FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_day - , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_dow - , EXTRACT(doy FROM lux_listings_src_10021.valid_to) AS lux_listing__window_end__extract_doy - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - , lux_listings_src_10021.lux_listing_id AS lux_listing - FROM ***************************.dim_lux_listings lux_listings_src_10021 + lux_listings_src_26004.valid_from AS window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS window_start__extract_day + , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_26004.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS window_start__extract_doy + , lux_listings_src_26004.valid_to AS window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS window_end__extract_day + , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_26004.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux + , lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_from) AS lux_listing__window_start__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_from) AS lux_listing__window_start__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_from) AS lux_listing__window_start__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_from) AS lux_listing__window_start__year + , EXTRACT(year FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_from) AS lux_listing__window_start__extract_doy + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , DATE_TRUNC('week', lux_listings_src_26004.valid_to) AS lux_listing__window_end__week + , DATE_TRUNC('month', lux_listings_src_26004.valid_to) AS lux_listing__window_end__month + , DATE_TRUNC('quarter', lux_listings_src_26004.valid_to) AS lux_listing__window_end__quarter + , DATE_TRUNC('year', lux_listings_src_26004.valid_to) AS lux_listing__window_end__year + , EXTRACT(year FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(quarter FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(month FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(day FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAY_OF_WEEK FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_26004.valid_to) AS lux_listing__window_end__extract_doy + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + , lux_listings_src_26004.lux_listing_id AS lux_listing + FROM ***************************.dim_lux_listings lux_listings_src_26004 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0_optimized.sql index bdf9f86508..0ef5f08ffa 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -14,21 +14,21 @@ FROM ( DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10017 + FROM ***************************.fct_bookings bookings_source_src_26000 ) subq_13 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['lux_listing__is_confirmed_lux', 'lux_listing__window_start__day', 'lux_listing__window_end__day', 'listing'] SELECT - lux_listings_src_10021.valid_from AS lux_listing__window_start__day - , lux_listings_src_10021.valid_to AS lux_listing__window_end__day - , lux_listing_mapping_src_10020.listing_id AS listing - , lux_listings_src_10021.is_confirmed_lux AS lux_listing__is_confirmed_lux - FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10020 + lux_listings_src_26004.valid_from AS lux_listing__window_start__day + , lux_listings_src_26004.valid_to AS lux_listing__window_end__day + , lux_listing_mapping_src_26003.listing_id AS listing + , lux_listings_src_26004.is_confirmed_lux AS lux_listing__is_confirmed_lux + FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_26003 LEFT OUTER JOIN - ***************************.dim_lux_listings lux_listings_src_10021 + ***************************.dim_lux_listings lux_listings_src_26004 ON - lux_listing_mapping_src_10020.lux_listing_id = lux_listings_src_10021.lux_listing_id + lux_listing_mapping_src_26003.lux_listing_id = lux_listings_src_26004.lux_listing_id ) subq_18 ON ( diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql index 32ce24589a..a10cff334a 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql @@ -91,55 +91,55 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'account_month_txns' SELECT - account_month_txns_src_10012.txn_count - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_10012.ds) AS ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS ds__extract_doy - , account_month_txns_src_10012.account_month - , DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , DATE_TRUNC('day', account_month_txns_src_10012.ds) AS account_id__ds__day - , DATE_TRUNC('week', account_month_txns_src_10012.ds) AS account_id__ds__week - , DATE_TRUNC('month', account_month_txns_src_10012.ds) AS account_id__ds__month - , DATE_TRUNC('quarter', account_month_txns_src_10012.ds) AS account_id__ds__quarter - , DATE_TRUNC('year', account_month_txns_src_10012.ds) AS account_id__ds__year - , EXTRACT(year FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_year - , EXTRACT(quarter FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_quarter - , EXTRACT(month FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_month - , EXTRACT(day FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_dow - , EXTRACT(doy FROM account_month_txns_src_10012.ds) AS account_id__ds__extract_doy - , account_month_txns_src_10012.account_month AS account_id__account_month - , account_month_txns_src_10012.account_id - FROM ***************************.account_month_txns account_month_txns_src_10012 + account_month_txns_src_22000.txn_count + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy + , account_month_txns_src_22000.account_month + , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day + , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week + , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month + , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter + , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year + , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year + , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter + , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month + , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy + , account_month_txns_src_22000.account_month AS account_id__account_month + , account_month_txns_src_22000.account_id + FROM ***************************.account_month_txns account_month_txns_src_22000 ) subq_0 ) subq_1 ) subq_2 @@ -209,48 +209,48 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bridge_table' SELECT - bridge_table_src_10013.extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS account_id__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS account_id__ds_partitioned__extract_doy - , bridge_table_src_10013.extra_dim AS bridge_account__extra_dim - , DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__day - , DATE_TRUNC('week', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__week - , DATE_TRUNC('month', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__month - , DATE_TRUNC('quarter', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__quarter - , DATE_TRUNC('year', bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__year - , EXTRACT(year FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_year - , EXTRACT(quarter FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter - , EXTRACT(month FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_month - , EXTRACT(day FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow - , EXTRACT(doy FROM bridge_table_src_10013.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy - , bridge_table_src_10013.account_id - , bridge_table_src_10013.customer_id - , bridge_table_src_10013.customer_id AS account_id__customer_id - , bridge_table_src_10013.account_id AS bridge_account__account_id - , bridge_table_src_10013.customer_id AS bridge_account__customer_id - FROM ***************************.bridge_table bridge_table_src_10013 + bridge_table_src_22001.extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS account_id__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_22001.extra_dim AS bridge_account__extra_dim + , DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(day FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_22001.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy + , bridge_table_src_22001.account_id + , bridge_table_src_22001.customer_id + , bridge_table_src_22001.customer_id AS account_id__customer_id + , bridge_table_src_22001.account_id AS bridge_account__account_id + , bridge_table_src_22001.customer_id AS bridge_account__customer_id + FROM ***************************.bridge_table bridge_table_src_22001 ) subq_3 LEFT OUTER JOIN ( -- Pass Only Elements: [ @@ -313,34 +313,34 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_table' SELECT - customer_table_src_10015.customer_name - , customer_table_src_10015.customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS ds_partitioned__extract_doy - , customer_table_src_10015.customer_name AS customer_id__customer_name - , customer_table_src_10015.customer_atomic_weight AS customer_id__customer_atomic_weight - , DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__day - , DATE_TRUNC('week', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__week - , DATE_TRUNC('month', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__month - , DATE_TRUNC('quarter', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__quarter - , DATE_TRUNC('year', customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__year - , EXTRACT(year FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_year - , EXTRACT(quarter FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter - , EXTRACT(month FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(day FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_dow - , EXTRACT(doy FROM customer_table_src_10015.ds_partitioned) AS customer_id__ds_partitioned__extract_doy - , customer_table_src_10015.customer_id - FROM ***************************.customer_table customer_table_src_10015 + customer_table_src_22003.customer_name + , customer_table_src_22003.customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS ds_partitioned__extract_doy + , customer_table_src_22003.customer_name AS customer_id__customer_name + , customer_table_src_22003.customer_atomic_weight AS customer_id__customer_atomic_weight + , DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__day + , DATE_TRUNC('week', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(year FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(quarter FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(month FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(day FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_22003.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , customer_table_src_22003.customer_id + FROM ***************************.customer_table customer_table_src_22003 ) subq_4 ) subq_5 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql index 37c292fbea..7802d2f867 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql @@ -4,30 +4,30 @@ -- Compute Metrics via Expressions SELECT subq_18.customer_id__customer_name AS account_id__customer_id__customer_name - , SUM(account_month_txns_src_10012.txn_count) AS txn_count -FROM ***************************.account_month_txns account_month_txns_src_10012 + , SUM(account_month_txns_src_22000.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_22000 LEFT OUTER JOIN ( -- Join Standard Outputs -- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id'] SELECT - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) AS ds_partitioned__day - , bridge_table_src_10013.account_id AS account_id - , customer_table_src_10015.customer_name AS customer_id__customer_name - FROM ***************************.bridge_table bridge_table_src_10013 + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) AS ds_partitioned__day + , bridge_table_src_22001.account_id AS account_id + , customer_table_src_22003.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_22001 LEFT OUTER JOIN - ***************************.customer_table customer_table_src_10015 + ***************************.customer_table customer_table_src_22003 ON ( - bridge_table_src_10013.customer_id = customer_table_src_10015.customer_id + bridge_table_src_22001.customer_id = customer_table_src_22003.customer_id ) AND ( - DATE_TRUNC('day', bridge_table_src_10013.ds_partitioned) = DATE_TRUNC('day', customer_table_src_10015.ds_partitioned) + DATE_TRUNC('day', bridge_table_src_22001.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22003.ds_partitioned) ) ) subq_18 ON ( - account_month_txns_src_10012.account_id = subq_18.account_id + account_month_txns_src_22000.account_id = subq_18.account_id ) AND ( - DATE_TRUNC('day', account_month_txns_src_10012.ds_partitioned) = subq_18.ds_partitioned__day + DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_18.ds_partitioned__day ) GROUP BY subq_18.customer_id__customer_name diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0.sql index fff3ba565e..2bdfb4e837 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0.sql @@ -221,93 +221,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 WHERE subq_1.metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01' @@ -471,62 +471,62 @@ CROSS JOIN ( -- Read Elements From Semantic Model 'listings_latest' SELECT 1 AS listings - , listings_latest_src_10005.capacity AS largest_listing - , listings_latest_src_10005.capacity AS smallest_listing - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS created_at__extract_doy - , listings_latest_src_10005.country AS country_latest - , listings_latest_src_10005.is_lux AS is_lux_latest - , listings_latest_src_10005.capacity AS capacity_latest - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__ds__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__ds__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__ds__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__ds__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__ds__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__ds__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__ds__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__ds__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__ds__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__ds__extract_doy - , DATE_TRUNC('day', listings_latest_src_10005.created_at) AS listing__created_at__day - , DATE_TRUNC('week', listings_latest_src_10005.created_at) AS listing__created_at__week - , DATE_TRUNC('month', listings_latest_src_10005.created_at) AS listing__created_at__month - , DATE_TRUNC('quarter', listings_latest_src_10005.created_at) AS listing__created_at__quarter - , DATE_TRUNC('year', listings_latest_src_10005.created_at) AS listing__created_at__year - , EXTRACT(year FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_year - , EXTRACT(quarter FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_quarter - , EXTRACT(month FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_month - , EXTRACT(day FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_dow - , EXTRACT(doy FROM listings_latest_src_10005.created_at) AS listing__created_at__extract_doy - , listings_latest_src_10005.country AS listing__country_latest - , listings_latest_src_10005.is_lux AS listing__is_lux_latest - , listings_latest_src_10005.capacity AS listing__capacity_latest - , listings_latest_src_10005.listing_id AS listing - , listings_latest_src_10005.user_id AS user - , listings_latest_src_10005.user_id AS listing__user - FROM ***************************.dim_listings_latest listings_latest_src_10005 + , listings_latest_src_28005.capacity AS largest_listing + , listings_latest_src_28005.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy + , listings_latest_src_28005.country AS country_latest + , listings_latest_src_28005.is_lux AS is_lux_latest + , listings_latest_src_28005.capacity AS capacity_latest + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year + , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year + , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter + , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month + , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy + , listings_latest_src_28005.country AS listing__country_latest + , listings_latest_src_28005.is_lux AS listing__is_lux_latest + , listings_latest_src_28005.capacity AS listing__capacity_latest + , listings_latest_src_28005.listing_id AS listing + , listings_latest_src_28005.user_id AS user + , listings_latest_src_28005.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_28005 ) subq_6 ) subq_7 WHERE subq_7.metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01' diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0_optimized.sql index a1e840fcb4..43332be222 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multiple_metrics_no_dimensions__plan0_optimized.sql @@ -11,7 +11,7 @@ FROM ( -- Compute Metrics via Expressions SELECT SUM(1) AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 WHERE DATE_TRUNC('day', ds) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01' ) subq_17 CROSS JOIN ( @@ -23,6 +23,6 @@ CROSS JOIN ( -- Compute Metrics via Expressions SELECT SUM(1) AS listings - FROM ***************************.dim_listings_latest listings_latest_src_10005 + FROM ***************************.dim_listings_latest listings_latest_src_28005 WHERE DATE_TRUNC('day', created_at) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01' ) subq_23 diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql index 6450bf5f6a..1cd73f8aa2 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql @@ -94,56 +94,56 @@ FROM ( -- Read Elements From Semantic Model 'id_verifications' SELECT 1 AS identity_verifications - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds) AS ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type - , DATE_TRUNC('day', id_verifications_src_10004.ds) AS verification__ds__day - , DATE_TRUNC('week', id_verifications_src_10004.ds) AS verification__ds__week - , DATE_TRUNC('month', id_verifications_src_10004.ds) AS verification__ds__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds) AS verification__ds__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds) AS verification__ds__year - , EXTRACT(year FROM id_verifications_src_10004.ds) AS verification__ds__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds) AS verification__ds__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds) AS verification__ds__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds) AS verification__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds) AS verification__ds__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds) AS verification__ds__extract_doy - , DATE_TRUNC('day', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__day - , DATE_TRUNC('week', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__week - , DATE_TRUNC('month', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__month - , DATE_TRUNC('quarter', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__quarter - , DATE_TRUNC('year', id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__year - , EXTRACT(year FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_year - , EXTRACT(quarter FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_quarter - , EXTRACT(month FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(day FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(doy FROM id_verifications_src_10004.ds_partitioned) AS verification__ds_partitioned__extract_doy - , id_verifications_src_10004.verification_type AS verification__verification_type - , id_verifications_src_10004.verification_id AS verification - , id_verifications_src_10004.user_id AS user - , id_verifications_src_10004.user_id AS verification__user - FROM ***************************.fct_id_verifications id_verifications_src_10004 + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type + , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day + , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year + , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy + , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day + , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy + , id_verifications_src_28004.verification_type AS verification__verification_type + , id_verifications_src_28004.verification_id AS verification + , id_verifications_src_28004.user_id AS user + , id_verifications_src_28004.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_0 ) subq_1 ) subq_2 @@ -156,76 +156,76 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_10008.ds) AS ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_10008.created_at) AS created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state - , DATE_TRUNC('day', users_ds_source_src_10008.ds) AS user__ds__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_ds_source_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds) AS user__ds__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds) AS user__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds) AS user__ds__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.created_at) AS user__created_at__day - , DATE_TRUNC('week', users_ds_source_src_10008.created_at) AS user__created_at__week - , DATE_TRUNC('month', users_ds_source_src_10008.created_at) AS user__created_at__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.created_at) AS user__created_at__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.created_at) AS user__created_at__year - , EXTRACT(year FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.created_at) AS user__created_at__extract_doy - , DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__day - , DATE_TRUNC('week', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__week - , DATE_TRUNC('month', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__month - , DATE_TRUNC('quarter', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__quarter - , DATE_TRUNC('year', users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__year - , EXTRACT(year FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_year - , EXTRACT(quarter FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_quarter - , EXTRACT(month FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(day FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_dow - , EXTRACT(doy FROM users_ds_source_src_10008.ds_partitioned) AS user__ds_partitioned__extract_doy - , users_ds_source_src_10008.home_state AS user__home_state - , users_ds_source_src_10008.user_id AS user - FROM ***************************.dim_users users_ds_source_src_10008 + DATE_TRUNC('day', users_ds_source_src_28008.ds) AS ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_28008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_28008.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state + , DATE_TRUNC('day', users_ds_source_src_28008.ds) AS user__ds__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds) AS user__ds__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds) AS user__ds__year + , EXTRACT(year FROM users_ds_source_src_28008.ds) AS user__ds__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds) AS user__ds__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds) AS user__ds__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds) AS user__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_28008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds) AS user__ds__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.created_at) AS user__created_at__day + , DATE_TRUNC('week', users_ds_source_src_28008.created_at) AS user__created_at__week + , DATE_TRUNC('month', users_ds_source_src_28008.created_at) AS user__created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.created_at) AS user__created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.created_at) AS user__created_at__year + , EXTRACT(year FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.created_at) AS user__created_at__extract_doy + , DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__day + , DATE_TRUNC('week', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(year FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(quarter FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(month FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(day FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_28008.ds_partitioned) AS user__ds_partitioned__extract_doy + , users_ds_source_src_28008.home_state AS user__home_state + , users_ds_source_src_28008.user_id AS user + FROM ***************************.dim_users users_ds_source_src_28008 ) subq_3 ) subq_4 ON diff --git a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql index 74fbab8b7e..9f15f9bb3d 100644 --- a/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql @@ -3,7 +3,7 @@ -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_ds_source_src_10008.home_state AS user__home_state + users_ds_source_src_28008.home_state AS user__home_state , SUM(subq_10.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' @@ -13,15 +13,15 @@ FROM ( DATE_TRUNC('day', ds_partitioned) AS ds_partitioned__day , user_id AS user , 1 AS identity_verifications - FROM ***************************.fct_id_verifications id_verifications_src_10004 + FROM ***************************.fct_id_verifications id_verifications_src_28004 ) subq_10 LEFT OUTER JOIN - ***************************.dim_users users_ds_source_src_10008 + ***************************.dim_users users_ds_source_src_28008 ON ( - subq_10.user = users_ds_source_src_10008.user_id + subq_10.user = users_ds_source_src_28008.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_10008.ds_partitioned) + subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28008.ds_partitioned) ) GROUP BY - users_ds_source_src_10008.home_state + users_ds_source_src_28008.home_state diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml index f2c991d978..28a7bc30b8 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml @@ -42,11 +42,11 @@ - + - + @@ -59,11 +59,11 @@ - + - + @@ -110,11 +110,11 @@ - + - + @@ -127,11 +127,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml index c672eced1d..90933d02e1 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml @@ -44,11 +44,11 @@ - + - + @@ -61,11 +61,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml index 1edda3138f..558d1e2dc2 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -46,11 +46,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml index 98379316a2..0b77d28ea5 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml @@ -20,11 +20,11 @@ - + - + @@ -46,11 +46,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml index 5ae9631733..f577c138b7 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml @@ -27,11 +27,11 @@ - + - + @@ -53,11 +53,11 @@ - + - + @@ -88,11 +88,11 @@ - + - + @@ -114,11 +114,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml index cb79550f2a..23c29f544a 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml @@ -27,11 +27,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml index 983767ece5..e491d7b0de 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -46,11 +46,11 @@ - + - + @@ -72,11 +72,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml index 3eb6059ba7..7b01dc3bd2 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml @@ -22,11 +22,11 @@ - + - + @@ -48,11 +48,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml index 92d7367013..77fe189838 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -78,11 +78,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml index 0ea28d8b15..5e0a12cba5 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml @@ -20,11 +20,11 @@ - + - + @@ -78,11 +78,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml index 53c541f1a3..e294565a6c 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml @@ -24,11 +24,11 @@ - + - + @@ -50,11 +50,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml index f876a379f4..f489e0e902 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml @@ -23,11 +23,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml index 3166c5aeca..18e6681969 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -53,11 +53,11 @@ - + - + @@ -79,11 +79,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml index 5619800d39..dcfc0e5735 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml @@ -20,11 +20,11 @@ - + - + @@ -53,11 +53,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml index 9a370afec2..0cf2034bdc 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml @@ -24,11 +24,11 @@ - + - + @@ -55,11 +55,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfpo_0.xml index b39e3b49b0..c624ee45d5 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfpo_0.xml @@ -22,11 +22,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml index f36cbb7225..4eec343e09 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml @@ -32,11 +32,11 @@ - + - + @@ -59,11 +59,11 @@ - + - + @@ -87,11 +87,11 @@ - + - + @@ -113,11 +113,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml index e5b37f70a9..9841bd4002 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml @@ -31,11 +31,11 @@ - + - + @@ -61,11 +61,11 @@ - + - + diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql index e4da8c4ee5..8cb7b567a7 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 - , DATE_TRUNC(bookings_source_src_10001.ds, day) 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, day) 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC(bookings_source_src_10001.paid_at, day) 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , IF(EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) - 1) 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day + , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql index 9e7eaa10f6..65f70748f5 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine__plan0_optimized.sql @@ -16,7 +16,7 @@ LEFT OUTER JOIN ( SELECT DATE_TRUNC(ds, day) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0.sql index 32f6d7c58b..4f54d41a0e 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK_ISO 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0_optimized.sql index 9fca36bce8..0a37042296 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine__plan0_optimized.sql @@ -16,7 +16,7 @@ LEFT OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0.sql index cced3a1cdd..314870a5d1 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0_optimized.sql index 9fca36bce8..0a37042296 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine__plan0_optimized.sql @@ -16,7 +16,7 @@ LEFT OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0.sql index cced3a1cdd..314870a5d1 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(isodow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(isodow 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(isodow 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0_optimized.sql index 9fca36bce8..0a37042296 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine__plan0_optimized.sql @@ -16,7 +16,7 @@ LEFT OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0.sql index 567b95069b..7a5db10dcb 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds) END AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) END AS booking__ds_partitioned__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , CASE WHEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_10001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_10001.paid_at) END 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0_optimized.sql index 9fca36bce8..0a37042296 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine__plan0_optimized.sql @@ -16,7 +16,7 @@ LEFT OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0.sql index b7a0ed949c..a43e8a7ec5 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(dayofweekiso 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(dayofweekiso 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0_optimized.sql index 9fca36bce8..0a37042296 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine__plan0_optimized.sql @@ -16,7 +16,7 @@ LEFT OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0.sql index 2c6b6179bb..dddc2cb798 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0.sql @@ -129,93 +129,93 @@ FROM ( 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 + , bookings_source_src_28001.booking_value + , bookings_source_src_28001.booking_value AS max_booking_value + , bookings_source_src_28001.booking_value AS min_booking_value + , bookings_source_src_28001.guest_id AS bookers + , bookings_source_src_28001.booking_value AS average_booking_value + , bookings_source_src_28001.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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAY_OF_WEEK 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 - , DATE_TRUNC('day', 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(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAY_OF_WEEK 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 + , bookings_source_src_28001.booking_value AS median_booking_value + , bookings_source_src_28001.booking_value AS booking_value_p99 + , bookings_source_src_28001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28001.is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy + , bookings_source_src_28001.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28001.listing_id AS listing + , bookings_source_src_28001.guest_id AS guest + , bookings_source_src_28001.host_id AS host + , bookings_source_src_28001.listing_id AS booking__listing + , bookings_source_src_28001.guest_id AS booking__guest + , bookings_source_src_28001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_0 ) subq_1 ) subq_2 diff --git a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0_optimized.sql b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0_optimized.sql index 9fca36bce8..0a37042296 100644 --- a/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine__plan0_optimized.sql @@ -16,7 +16,7 @@ LEFT OUTER JOIN ( SELECT DATE_TRUNC('day', ds) AS metric_time__day , 1 AS bookings - FROM ***************************.fct_bookings bookings_source_src_10001 + FROM ***************************.fct_bookings bookings_source_src_28001 ) subq_9 GROUP BY metric_time__day diff --git a/metricflow/test/test_instance_serialization.py b/metricflow/test/test_instance_serialization.py index d74aebabbb..2aa9eb8ea6 100644 --- a/metricflow/test/test_instance_serialization.py +++ b/metricflow/test/test_instance_serialization.py @@ -1,12 +1,13 @@ from __future__ import annotations import logging +from typing import Mapping import pytest from dbt_semantic_interfaces.dataclass_serialization import DataClassDeserializer, DataclassSerializer from metricflow.instances import InstanceSet -from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository +from metricflow.test.fixtures.manifest_fixtures import MetricFlowEngineTestFixture, SemanticManifestSetup logger = logging.getLogger(__name__) @@ -22,11 +23,11 @@ def deserializer() -> DataClassDeserializer: # noqa: D def test_serialization( # noqa: D - consistent_id_object_repository: ConsistentIdObjectRepository, + mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture], serializer: DataclassSerializer, deserializer: DataClassDeserializer, ) -> None: - for _, data_set in consistent_id_object_repository.simple_model_data_sets.items(): + for _, data_set in mf_engine_test_fixture_mapping[SemanticManifestSetup.SIMPLE_MANIFEST].data_set_mapping.items(): serialized_obj = serializer.pydantic_serialize(data_set.instance_set) deserialized_obj = deserializer.pydantic_deserialize(dataclass_type=InstanceSet, serialized_obj=serialized_obj) assert data_set.instance_set == deserialized_obj